1

I have tried a software. It work flawless on the first laptop in a fresh install arduino IDE environment with the libraries I imported.

However when I copy the exact same program over. I get lot of errors and tried to clean up some of the old libraries from earlier programs. Then rerun the compiler; got even more errors and I am not sure what to do except completely clean everything including older libraries that I may need to keep around for older programs.

My includes are as following:

#include <AccelStepper.h>
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"

Error from the Arduino IDE from the second laptop is as following:

Arduino: 1.6.7 (Windows 10), Board: "Arduino/Genuino Uno"

Invalid library found in C:\Users\B Family\Documents\Arduino\libraries\examples: C:\Users\B Family\Documents\Arduino\libraries\examples

libraries\utility\Adafruit_MS_PWMServoDriver.cpp.o: In function `Adafruit_MS_PWMServoDriver::Adafruit_MS_PWMServoDriver(unsigned char)':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: multiple definition of `Adafruit_MS_PWMServoDriver::Adafruit_MS_PWMServoDriver(unsigned char)'

libraries\Adafruit_Motor_Shield_V2_Library-master\utility\Adafruit_MS_PWMServoDriver.cpp.o:C:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master\utility/Adafruit_MS_PWMServoDriver.cpp:28: first defined here

libraries\utility\Adafruit_MS_PWMServoDriver.cpp.o: In function `Adafruit_MS_PWMServoDriver::Adafruit_MS_PWMServoDriver(unsigned char)':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: multiple definition of `Adafruit_MS_PWMServoDriver::Adafruit_MS_PWMServoDriver(unsigned char)'

libraries\Adafruit_Motor_Shield_V2_Library-master\utility\Adafruit_MS_PWMServoDriver.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: first defined here

libraries\utility\Adafruit_MS_PWMServoDriver.cpp.o: In function `Adafruit_MS_PWMServoDriver::Adafruit_MS_PWMServoDriver(unsigned char)':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: multiple definition of `Adafruit_MS_PWMServoDriver::setPWM(unsigned char, unsigned int, unsigned int)'

libraries\Adafruit_Motor_Shield_V2_Library-master\utility\Adafruit_MS_PWMServoDriver.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: first defined here

libraries\utility\Adafruit_MS_PWMServoDriver.cpp.o: In function `Adafruit_MS_PWMServoDriver::Adafruit_MS_PWMServoDriver(unsigned char)':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: multiple definition of `Adafruit_MS_PWMServoDriver::write8(unsigned char, unsigned char)'

libraries\Adafruit_Motor_Shield_V2_Library-master\utility\Adafruit_MS_PWMServoDriver.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: first defined here

libraries\utility\Adafruit_MS_PWMServoDriver.cpp.o: In function `Adafruit_MS_PWMServoDriver::Adafruit_MS_PWMServoDriver(unsigned char)':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: multiple definition of `Adafruit_MS_PWMServoDriver::reset()'

libraries\Adafruit_Motor_Shield_V2_Library-master\utility\Adafruit_MS_PWMServoDriver.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: first defined here

libraries\utility\Adafruit_MS_PWMServoDriver.cpp.o: In function `Adafruit_MS_PWMServoDriver::Adafruit_MS_PWMServoDriver(unsigned char)':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: multiple definition of `Adafruit_MS_PWMServoDriver::begin()'

libraries\Adafruit_Motor_Shield_V2_Library-master\utility\Adafruit_MS_PWMServoDriver.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: first defined here

libraries\utility\Adafruit_MS_PWMServoDriver.cpp.o: In function `Adafruit_MS_PWMServoDriver::Adafruit_MS_PWMServoDriver(unsigned char)':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: multiple definition of `Adafruit_MS_PWMServoDriver::read8(unsigned char)'

libraries\Adafruit_Motor_Shield_V2_Library-master\utility\Adafruit_MS_PWMServoDriver.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: first defined here

libraries\utility\Adafruit_MS_PWMServoDriver.cpp.o: In function `Adafruit_MS_PWMServoDriver::Adafruit_MS_PWMServoDriver(unsigned char)':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: multiple definition of `Adafruit_MS_PWMServoDriver::setPWMFreq(float)'

libraries\Adafruit_Motor_Shield_V2_Library-master\utility\Adafruit_MS_PWMServoDriver.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:77: first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
0

The diagnostics tell you exactly what is wrong! You have multiple copies of the same library, probably because you installed it at different times from different places. The diagnostics even tell you which libraries are duplicates. Remove them and everything will work fine!

While we are at it: another source of duplicate definitions is badly written .h files that define (as opposed to only declaring) external symbols. Those you have to deal with as they happen, there is no global solution.

  • While there were some stuff you got wrong. Turn out that Arduino was looking for libraries in TWO places and it didn't specific which one in compiler errors. So I had to delete those in Document > Arduino > Libraries. Turn out the %arduino install path% > libraries had the correct libraries after all. – Vyndicu Apr 13 '16 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.