Hello,
I started to use MPU6050 library about a week ago and it was a delicious thing, thanks for that.
Since I want to use it in a quadcopter, sensor readings is not all the work, so I created a library and do the sensor stuff under that library for simplicity of the main program. That's when I encountered with multiple definitions problem.
In my library, I included 6 axis motion apps library and try to do initializing and reading. The error output is below. I use Visual Micro for Arduino programming but Arduino IDE gives the same error. I couldn't find multiple definitions, so any help would be great.
Thanks in advance.
Compiling 'QuadroCopter_v0_92' for 'Arduino Mega 2560 or Mega ADK'
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetAccel(long*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetAccel(long*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:577: first defined here
ld.exe:Disabling relaxation: it will not work with multiple definitions
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetAccel(int*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetAccel(int*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:585: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetAccel(VectorInt16*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetAccel(VectorInt16*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:593: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetQuaternion(long*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetQuaternion(long*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:601: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetQuaternion(int*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetQuaternion(int*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:610: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetQuaternion(Quaternion*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetQuaternion(Quaternion*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:619: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetGyro(long*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetGyro(long*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:634: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetGyro(int*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetGyro(int*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:642: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetLinearAccel(VectorInt16*, VectorInt16*, VectorFloat*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetLinearAccel(VectorInt16*, VectorInt16*, VectorFloat*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:652: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetGravity(VectorFloat*, Quaternion*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetGravity(VectorFloat*, Quaternion*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:672: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpProcessFIFOPacket(unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpProcessFIFOPacket(unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:711: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetFIFOPacketSize()'
MPU6050_6Axis_MotionApps20.cpp:dmpGetFIFOPacketSize()'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:737: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpReadAndProcessFIFOPacket(unsigned char, unsigned char*)'
MPU6050_6Axis_MotionApps20.cpp:dmpReadAndProcessFIFOPacket(unsigned char, unsigned char*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:712: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetYawPitchRoll(float*, Quaternion*, VectorFloat*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetYawPitchRoll(float*, Quaternion*, VectorFloat*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:689: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetEuler(float*, Quaternion*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetEuler(float*, Quaternion*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:683: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpGetLinearAccelInWorld(VectorInt16*, VectorInt16*, Quaternion*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetLinearAccelInWorld(VectorInt16*, VectorInt16*, Quaternion*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:660: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpPacketAvailable()'
MPU6050_6Axis_MotionApps20.cpp:dmpPacketAvailable()'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:550: first defined here
MPU6050_6Axis_MotionApps20.cpp.o:In function `MPU6050::dmpInitialize()'
MPU6050_6Axis_MotionApps20.cpp:dmpInitialize()'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:325: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetAccel(long*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetAccel(long*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:577: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetAccel(int*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetAccel(int*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:585: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetAccel(VectorInt16*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetAccel(VectorInt16*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:593: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetQuaternion(long*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetQuaternion(long*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:601: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetQuaternion(int*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetQuaternion(int*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:610: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetQuaternion(Quaternion*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetQuaternion(Quaternion*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:619: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetGyro(long*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetGyro(long*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:634: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetGyro(int*, unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetGyro(int*, unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:642: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetLinearAccel(VectorInt16*, VectorInt16*, VectorFloat*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetLinearAccel(VectorInt16*, VectorInt16*, VectorFloat*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:652: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetGravity(VectorFloat*, Quaternion*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetGravity(VectorFloat*, Quaternion*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:672: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpProcessFIFOPacket(unsigned char const*)'
MPU6050_6Axis_MotionApps20.cpp:dmpProcessFIFOPacket(unsigned char const*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:711: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetFIFOPacketSize()'
MPU6050_6Axis_MotionApps20.cpp:dmpGetFIFOPacketSize()'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:737: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpReadAndProcessFIFOPacket(unsigned char, unsigned char*)'
MPU6050_6Axis_MotionApps20.cpp:dmpReadAndProcessFIFOPacket(unsigned char, unsigned char*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:712: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetYawPitchRoll(float*, Quaternion*, VectorFloat*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetYawPitchRoll(float*, Quaternion*, VectorFloat*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:689: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetEuler(float*, Quaternion*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetEuler(float*, Quaternion*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:683: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpGetLinearAccelInWorld(VectorInt16*, VectorInt16*, Quaternion*)'
MPU6050_6Axis_MotionApps20.cpp:dmpGetLinearAccelInWorld(VectorInt16*, VectorInt16*, Quaternion*)'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:660: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpPacketAvailable()'
MPU6050_6Axis_MotionApps20.cpp:dmpPacketAvailable()'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:550: first defined here
QuadroCopter_v0_92.cpp.o:In function `MPU6050::dmpInitialize()'
MPU6050_6Axis_MotionApps20.cpp:dmpInitialize()'
BBSensors.cpp.o:\MPU6050_6Axis_MotionApps20.cpp:325: first defined here
Error creating .elf