Error compiling arduino uno pls reply

this is the code please resolve the error waiting for the reply

#include <Servo.h>
#include <AFMotor.h>
#define Echo A0
#define Trig A1
#define Speed 170
#define spoint 103

char value;
int distance;
int Left;
int Right;
int L = 0;
int R = 0;
int L1 = 0;
int R1 = 0;

Servo servo;
AF_DCMotor M1(1);
AF_DCMotor M2(2);
AF_DCMotor M3(3);
AF_DCMotor M4(4);

void setup() {
  Serial.begin(9600);
  pinMode(Trig, OUTPUT);
  pinMode(Echo, INPUT);
  servo.attach(1);
  M1.setSpeed(120);
  M2.setSpeed(120);
  M3.setSpeed(120);
  M4.setSpeed(120);
}
void loop() {
  Obstacle();
  //Bluetoothcontrol();
  //voicecontrol();
}



void Obstacle() {
  distance = ultrasonic();
  if (distance <= 12) {
    Stop();
    backward();
    delay(100);
    Stop();
    L = leftsee();
    servo.write(spoint);
    delay(800);
    R = rightsee();
    servo.write(spoint);
    if (L < R) {
      right();
      delay(500);
      Stop();
      delay(200);
    } else if (L > R) {
      left();
      delay(500);
      Stop();
      delay(200);
    }
  } else {
    forward();
  }
}

void voicecontrol() {
  if (Serial.available() > 0) {
    value = Serial.read();
    Serial.println(value);
    if (value == '^') {
      forward();
    } else if (value == '-') {
      backward();
    } else if (value == '<') {
      L = leftsee();
      servo.write(spoint);
      if (L >= 10) {
        left();
        delay(500);
        Stop();
      } else if (L < 10) {
        Stop();
      }
    } else if (value == '>') {
      R = rightsee();
      servo.write(spoint);
      if (R >= 10) {
        right();
        delay(500);
        Stop();
      } else if (R < 10) {
        Stop();
      }
    }
  }
}

int ultrasonic() {
  digitalWrite(Trig, LOW);
  delayMicroseconds(4);
  digitalWrite(Trig, HIGH);
  delayMicroseconds(10);
  digitalWrite(Trig, LOW);
  long t = pulseIn(Echo, HIGH);
  long cm = t / 29 / 2;  //time convert distance
  return cm;
}

void forward() {
  M1.run(FORWARD);
  M2.run(FORWARD);
  M3.run(FORWARD);
  M4.run(FORWARD);
}
void backward() {
  M1.run(BACKWARD);
  M2.run(BACKWARD);
  M3.run(BACKWARD);
  M4.run(BACKWARD);
}
void right() {
  M1.run(BACKWARD);
  M2.run(BACKWARD);
  M3.run(FORWARD);
  M4.run(FORWARD);
}
void left() {
  M1.run(FORWARD);
  M2.run(FORWARD);
  M3.run(BACKWARD);
  M4.run(BACKWARD);
}
void Stop() {
  M1.run(RELEASE);
  M2.run(RELEASE);
  M3.run(RELEASE);
  M4.run(RELEASE);
}
int rightsee() {
  servo.write(20);
  delay(800);
  Left = ultrasonic();
  return Left;
}

int leftsee() {
  servo.write(180);
  delay(800);
  Right = ultrasonic();
  return Right;
}


this is the error showing when uploading the code to arduino board R3

C:\Users\Admin\AppData\Local\Temp\ccTLdHcn.ltrans0.ltrans.o: In function `Stop()':
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:140: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:141: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:142: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:143: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\ccTLdHcn.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_sketch_feb20b.ino.cpp.o.1863':
<artificial>:(.text.startup+0xb8): undefined reference to `AF_DCMotor::AF_DCMotor(unsigned char, unsigned char)'
<artificial>:(.text.startup+0xc4): undefined reference to `AF_DCMotor::AF_DCMotor(unsigned char, unsigned char)'
<artificial>:(.text.startup+0xd0): undefined reference to `AF_DCMotor::AF_DCMotor(unsigned char, unsigned char)'
<artificial>:(.text.startup+0xdc): undefined reference to `AF_DCMotor::AF_DCMotor(unsigned char, unsigned char)'
C:\Users\Admin\AppData\Local\Temp\ccTLdHcn.ltrans0.ltrans.o: In function `setup':
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:31: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:32: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:33: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:34: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\ccTLdHcn.ltrans0.ltrans.o: In function `backward':
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:122: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:123: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:124: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:125: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\ccTLdHcn.ltrans0.ltrans.o: In function `right':
C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:128: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\ccTLdHcn.ltrans0.ltrans.o:C:\Users\Admin\AppData\Local\Temp\.arduinoIDE-unsaved2025120-9304-13m20kl.f9k5\sketch_feb20b/sketch_feb20b.ino:129: more undefined references to `AF_DCMotor::run(unsigned char)' follow
collect2.exe: error: ld returned 1 exit status
Multiple libraries were found for "Servo.h"
  Used: C:\Users\Admin\Documents\Arduino\libraries\Servo
  Not used: C:\Users\Admin\AppData\Local\Arduino15\libraries\Servo
exit status 1

Compilation error: exit status 1

You nearly got the code-tags right; you forgot to paste the code over type or paste code here :wink:

Fixed that for you.

This is not an upload program and hence your topic has been moved to a more suitable location on the forum.

Did you install the full library or only the .h file? Just asking because your code compiles here without errors; IDE 2.3.4, Win11.

I have downloaded full af motor library

OK

  1. Please delete the cache in C:\Users\yourUsername\AppData\Local\arduino.
  2. Please enable verbose output during compilation in file → preferences.
  3. Compile your sketch.
  4. Post the complete output here using code tags.

How to enable verbose output

It is also not working same problem

type or paste code here
```FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: C:\Users\Admin\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\Admin\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6

Detecting libraries used...
C:\Users\Admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\Admin\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Admin\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard C:\Users\Admin\AppData\Local\arduino\sketches\8ABAFD261FBA82689A5D4803052222C2\sketch\bluetooth_control_voice_obstacle.ino.cpp -o nul
Alternatives for Servo.h: [Servo@1.2.2 Servo@1.2.2]
ResolveLibrary(Servo.h)
  -> candidates: [Servo@1.2.2 Servo@1.2.2]
C:\Users\Admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\Admin\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Admin\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -IC:\Users\Admin\Documents\Arduino\libraries\Servo\src C:\Users\Admin\AppData\Local\arduino\sketches\8ABAFD261FBA82689A5D4803052222C2\sketch\bluetooth_control_voice_obstacle.ino.cpp -o nul
Alternatives for AFMotor.h: [Downloads]
ResolveLibrary(AFMotor.h)
  -> candidates: [Downloads]
C:\Users\Admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\Admin\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Admin\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -IC:\Users\Admin\Documents\Arduino\libraries\Servo\src -IC:\Users\Admin\Documents\Arduino\libraries\Downloads C:\Users\Admin\AppData\Local\arduino\sketches\8ABAFD261FBA82689A5D4803052222C2\sketch\bluetooth_control_voice_obstacle.ino.cpp -o nul
Using cached library dependencies for file: C:\Users\Admin\Documents\Arduino\libraries\Servo\src\avr\Servo.cpp
Using cached library dependencies for file: C:\Users\Admin\Documents\Arduino\libraries\Servo\src\mbed\Servo.cpp
Using cached library dependencies for file: C:\Users\Admin\Documents\Arduino\libraries\Servo\src\megaavr\Servo.cpp
Using cached library dependencies for file: C:\Users\Admin\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp
Using cached library dependencies for file: C:\Users\Admin\Documents\Arduino\libraries\Servo\src\renesas\Servo.cpp
Using cached library dependencies for file: C:\Users\Admin\Documents\Arduino\libraries\Servo\src\sam\Servo.cpp
Using cached library dependencies for file: C:\Users\Admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp
Using cached library dependencies for file: C:\Users\Admin\Documents\Arduino\libraries\Servo\src\stm32f4\Servo.cpp
Using cached library dependencies for file: C:\Users\Admin\Documents\Arduino\libraries\Servo\src\xmc\Servo.cpp
Generating function prototypes...
C:\Users\Admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\Admin\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Admin\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -IC:\Users\Admin\Documents\Arduino\libraries\Servo\src -IC:\Users\Admin\Documents\Arduino\libraries\Downloads C:\Users\Admin\AppData\Local\arduino\sketches\8ABAFD261FBA82689A5D4803052222C2\sketch\bluetooth_control_voice_obstacle.ino.cpp -o C:\Users\Admin\AppData\Local\Temp\4062067461\sketch_merged.cpp
C:\Users\Admin\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives C:\Users\Admin\AppData\Local\Temp\4062067461\sketch_merged.cpp
Compiling sketch...
"C:\\Users\\Admin\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Users\\Admin\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\Admin\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\standard" "-IC:\\Users\\Admin\\Documents\\Arduino\\libraries\\Servo\\src" "-IC:\\Users\\Admin\\Documents\\Arduino\\libraries\\Downloads" "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2\\sketch\\bluetooth_control_voice_obstacle.ino.cpp" -o "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2\\sketch\\bluetooth_control_voice_obstacle.ino.cpp.o"
Compiling libraries...
Compiling library "Servo"
Using previously compiled file: C:\Users\Admin\AppData\Local\arduino\sketches\8ABAFD261FBA82689A5D4803052222C2\libraries\Servo\nrf52\Servo.cpp.o
Using previously compiled file: C:\Users\Admin\AppData\Local\arduino\sketches\8ABAFD261FBA82689A5D4803052222C2\libraries\Servo\megaavr\Servo.cpp.o
Using previously compiled file: C:\Users\Admin\AppData\Local\arduino\sketches\8ABAFD261FBA82689A5D4803052222C2\libraries\Servo\mbed\Servo.cpp.o
Using previously compiled file: C:\Users\Admin\AppData\Local\arduino\sketches\8ABAFD261FBA82689A5D4803052222C2\libraries\Servo\renesas\Servo.cpp.o
Using previously compiled file: C:\Users\Admin\AppData\Local\arduino\sketches\8ABAFD261FBA82689A5D4803052222C2\libraries\Servo\stm32f4\Servo.cpp.o
Using previously compiled file: C:\Users\Admin\AppData\Local\arduino\sketches\8ABAFD261FBA82689A5D4803052222C2\libraries\Servo\samd\Servo.cpp.o
Using previously compiled file: C:\Users\Admin\AppData\Local\arduino\sketches\8ABAFD261FBA82689A5D4803052222C2\libraries\Servo\xmc\Servo.cpp.o
Using previously compiled file: C:\Users\Admin\AppData\Local\arduino\sketches\8ABAFD261FBA82689A5D4803052222C2\libraries\Servo\sam\Servo.cpp.o
Using previously compiled file: C:\Users\Admin\AppData\Local\arduino\sketches\8ABAFD261FBA82689A5D4803052222C2\libraries\Servo\avr\Servo.cpp.o
Compiling library "Downloads"
Compiling core...
Using precompiled core: C:\Users\Admin\AppData\Local\arduino\cores\arduino_avr_uno_6be783227e5bc0d57f51230f0c71f584\core.a
Linking everything together...
"C:\\Users\\Admin\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2/bluetooth_control_voice_obstacle.ino.elf" "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2\\sketch\\bluetooth_control_voice_obstacle.ino.cpp.o" "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2\\libraries\\Servo\\avr\\Servo.cpp.o" "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2\\libraries\\Servo\\mbed\\Servo.cpp.o" "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2\\libraries\\Servo\\megaavr\\Servo.cpp.o" "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2\\libraries\\Servo\\nrf52\\Servo.cpp.o" "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2\\libraries\\Servo\\renesas\\Servo.cpp.o" "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2\\libraries\\Servo\\sam\\Servo.cpp.o" "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2\\libraries\\Servo\\samd\\Servo.cpp.o" "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2\\libraries\\Servo\\stm32f4\\Servo.cpp.o" "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2\\libraries\\Servo\\xmc\\Servo.cpp.o" "C:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2/..\\..\\cores\\arduino_avr_uno_6be783227e5bc0d57f51230f0c71f584\\core.a" "-LC:\\Users\\Admin\\AppData\\Local\\arduino\\sketches\\8ABAFD261FBA82689A5D4803052222C2" -lm
C:\Users\Admin\AppData\Local\Temp\ccMnA9uH.ltrans0.ltrans.o: In function `Stop()':
C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:159: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:160: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:161: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:162: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\ccMnA9uH.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_bluetooth_control_voice_obstacle.ino.cpp.o.1868':
<artificial>:(.text.startup+0xb8): undefined reference to `AF_DCMotor::AF_DCMotor(unsigned char, unsigned char)'
<artificial>:(.text.startup+0xc4): undefined reference to `AF_DCMotor::AF_DCMotor(unsigned char, unsigned char)'
<artificial>:(.text.startup+0xd0): undefined reference to `AF_DCMotor::AF_DCMotor(unsigned char, unsigned char)'
<artificial>:(.text.startup+0xdc): undefined reference to `AF_DCMotor::AF_DCMotor(unsigned char, unsigned char)'
C:\Users\Admin\AppData\Local\Temp\ccMnA9uH.ltrans0.ltrans.o: In function `setup':
C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:31: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'
C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:32: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'
C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:33: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'
C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:34: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\ccMnA9uH.ltrans0.ltrans.o: In function `forward':
C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:135: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:136: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:137: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\ccMnA9uH.ltrans0.ltrans.o: In function `backward':
C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:144: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:141: undefined reference to `AF_DCMotor::run(unsigned char)'
C:\Users\Admin\AppData\Local\Temp\ccMnA9uH.ltrans0.ltrans.o:C:\Users\Admin\Downloads\bluetooth_control_voice_obstacle/bluetooth_control_voice_obstacle.ino:142: more undefined references to `AF_DCMotor::run(unsigned char)' follow
collect2.exe: error: ld returned 1 exit status
Multiple libraries were found for "Servo.h"
  Used: C:\Users\Admin\Documents\Arduino\libraries\Servo
  Not used: C:\Users\Admin\AppData\Local\Arduino15\libraries\Servo
Using library Servo at version 1.2.2 in folder: C:\Users\Admin\Documents\Arduino\libraries\Servo 
Using library Downloads in folder: C:\Users\Admin\Documents\Arduino\libraries\Downloads (legacy)
exit status 1

Compilation error: exit status 1

As @sterretje has already pointed out, the symptoms are typical of only downloading the AFMotor.h header file. Notice how there is no mention of compiling AFMotor.cpp anywhere in the verbose output. Or of using a cached library.

Help me out to rectify the issue

INSTALL the library

People are trying to help you.

You don't appear to be listening.

Something is seriously wrong with your setup (not the function) as far as I can see.

That should be

ResolveLibrary(AFMotor.h)
  -> candidates: [Adafruit Motor Shield library@1.0.1]
2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.