Compiling issue with Bricktronics shield

Hi,

I’ve been using your Bricktronics shields happily for a few years in my teaching. This year, after installing the libraries, I’m getting a compile issue, pasted below. I’m not sure what the problem is; can you help? Thank you!

The libraries I’ve installed are:
• Bricktronics Motor: https://github.com/wayneandlayne/BricktronicsMotor
• Bricktronics Shield
• Bricktronics Light

(removed most of my links because of forum restrictions)

I installed all of these, and also added verifysketchconfig.py (from bricktronics) to the Bricktronics library folders.

Any insight would be most appreciated.

Amy

“collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno”

Arduino: 1.8.1 (Mac OS X), Board: “Arduino/Genuino Uno”

Build options changed, rebuilding all
libraries/BricktronicsMotor/utility/Encoder.cpp.o (symbol from plugin): In function Encoder::interruptArgs': (.text+0x0): multiple definition ofEncoder::interruptArgs’
libraries/Encoder/Encoder.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::Compute()’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::SetTunings(double, double, double)’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::SetOutputLimits(double, double)’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::SetSampleTime(int)’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::Initialize()’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::SetMode(int)’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::SetControllerDirection(int)’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::PID(double*, double*, double*, double, double, double, int)’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::PID(double*, double*, double*, double, double, double, int)’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::GetKp()’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::GetKi()’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::GetKd()’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::GetMode()’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsMotor/utility/PID_v1.cpp.o (symbol from plugin): In function PID::Compute()': (.text+0x0): multiple definition ofPID::GetDirection()’
libraries/PID_v1/PID_v1.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::bitForPin(unsigned char)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::regForPin(unsigned char, unsigned char, unsigned char)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::writeRegister(unsigned char, unsigned char)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::begin(unsigned char)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::begin()’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::writeGPIOAB(unsigned int)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::readRegister(unsigned char)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::updateRegisterBit(unsigned char, unsigned char, unsigned char, unsigned char)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::pinMode(unsigned char, unsigned char)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::pullUp(unsigned char, unsigned char)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::setupInterruptPin(unsigned char, unsigned char)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::digitalWrite(unsigned char, unsigned char)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::digitalRead(unsigned char)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::setupInterrupts(unsigned char, unsigned char, unsigned char)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::getLastInterruptPin()’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::getLastInterruptPinValue()’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::readGPIOAB()’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/BricktronicsShield/utility/Adafruit_MCP23017.cpp.o (symbol from plugin): In function Adafruit_MCP23017::bitForPin(unsigned char)': (.text+0x0): multiple definition ofAdafruit_MCP23017::readGPIO(unsigned char)’
libraries/Adafruit-MCP23017-Arduino-Library/Adafruit_MCP23017.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.

Hello, thanks for the post. Sorry that you’ve run into a bit of trouble, I’m sure we can figure out what’s gone wrong.

I think I know what the problem is. When did you download the Bricktronics libraries? Recently (middle of Aug 2016) we got rid of the external dependencies on other libraries, so if you downloaded the Bricktronics libraries after that date you shouldn’t need to separately install the PID library, the Adafruit MCP23017 library, the Encoder library, etc.

Also, if you are using your own code from the old version of the libraries, then there is an important change that you need to make to work with the newer version of the libraries. Simply remove #includes for Encoder.h, PID_v1.h, and Adafruit_MCP23017.h from your code, and I think it should work then.

When I made that change to no-longer require other libraries to be installed separately, I updated all our library examples, but totally forgot about everyone’s existing code. I’ll have to make a blog post about migration changes from old to new libraries. Sorry that you got bit by this!

-Matthew
W&L

That was indeed the issue; thank you very much for the really helpful and rapid reply. I was using my own code, but so close to your code that I didn’t think to look for updates. This change makes things a whole lot easier on the whole (I’m sure that’s why you made the switch), so I’m glad for it despite the hiccup.

Amy

Oh excellent, I’m so glad that it was a quick fix. That’s exactly the reason we made the change to remove the external dependencies, I just forgot that existing code needed the includes removed. Thanks again!