Search code examples
c++arduino-unoarduino-ide

multiple definition of __vector_11’ arduino compiling problem


i'm using two libraries PCM.h for playing audio and Servo.h to control a servo motore

while compiling the project i'm getting this issue:

“libraries\PCM\PCM.c.o (symbol from plugin): In function startPlayback': (.text+0x0): multiple definition of __vector_11’

libraries\Servo\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here collect2.exe: error: ld returned 1 exit status exit status 1 Error compiling for board Arduino Uno.”

my board: Arduino duino uno

Arduino IDE version: 2.0.2

my code:

#include <Servo.h>
#include <PCM.h>

Servo Myservo;

int pos=0;


const unsigned char sample[] PROGMEM = {
126, 126, 126, 126, 127, 127, 127, 127,  };
**strong text**
void setup()
{
 Myservo.attach(4);
 myservo.write(0);
 startPlayback(sample, sizeof(sample));
}

void loop()
{
// other logic here
}

Solution

  • After making more research i found out that, There is a solution for this problem by switching library from using “Servo.h” To “PWMServo.h”.

    All you need to do is to install pwmservo and #include <PWMServo.h> instead off #include <Servo.h> while keeping all your code as it is and this will solve your problem,

    Happy crafting.