Exit status 1

Goodmorning all,

I' m working on an university project and i' m using GY-251 board(MPU6050).
I' m currently using this library:

As a base for my program i ' m using the pre-existing example "MPU6050_DMP6" contained inside MPU6050 library of the file i linked above.
When uploading or compiling the file, the following error appears:

collect2.exe: error: ld returned 1 exit status
exit status 1
Errore durante la compilazione per la scheda Arduino Uno.

preceeded by a series of Warnings given by how the library is written.
2 months ago i worked with the same Arduino Uno board, the same library and the same accelerometer board and no upload errors were encountered; only the "usual" library warnings were present.

I already tried uploading some simple codes and i encounter no problems in upload and the program works fine, also i tried substituting the compiler Id.exe with and older version but nothing has been resolved.

Can someone help me?

The error you shared is just the generic message that tells use only that something went wrong. There are a near infinite number of possible causes of this message. You need to scroll the black console pane at the bottom of the Arduino IDE window up and read the specific error messages. If you find that you still can’t fix the problem based on those error messages, then you’ll need to post the full and exact error output here so we can help you out:

  • When you encounter an error, you’ll see a button on the right side of the orange bar “Copy error messages” in the Arduino IDE (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button…
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum’s code tags markup to your reply.
  • Press “Ctrl + V”. This will paste the error between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

If the text exceeds the forum’s 9000 character limit, save it to a .txt file and post it as an attachment. If you click the “Reply” button here, you will see an “Attachments and other settings” link that will allow you to make the attachment.

I attached the file as you suggested.
Note that the same error occur when uploading the example “MPU6050_DMP6” attached below.

Thanks in advance!

Arduino error.txt (97.8 KB)

MPU6050 example.txt (17 KB)

Here's a sample of the relevant errors:

C:\Users\tommy\AppData\Local\Temp\arduino_build_484731\libraries\mpu6050-master\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':

(.text+0x0): multiple definition of `I2Cdev::I2Cdev()'

C:\Users\tommy\AppData\Local\Temp\arduino_build_484731\libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin):(.text+0x0): first defined here

and the other important part of the output:

Multiple libraries were found for "MPU6050_6Axis_MotionApps20.h"

C:\Users\tommy\OneDrive\Documents\Arduino\libraries\mpu6050-master\src\MPU6050.cpp:1679:9: note: implicit this pointer type mismatch

 Used: C:\Users\tommy\OneDrive\Documents\Arduino\libraries\mpu6050-master

 Not used: C:\Users\tommy\OneDrive\Documents\Arduino\libraries\MPU6050

Multiple libraries were found for "I2Cdev.h"

 Used: C:\Users\tommy\OneDrive\Documents\Arduino\libraries\I2Cdev

 Not used: C:\Users\tommy\OneDrive\Documents\Arduino\libraries\mpu6050-master

So the problem is that you have two libraries which contain a header file named "MPU6050_6Axis_MotionApps20.h":

  • C:\Users\tommy\OneDrive\Documents\Arduino\libraries\mpu6050-master
  • C:\Users\tommy\OneDrive\Documents\Arduino\libraries\MPU6050

From the paths, I can tell that the latter is this library:

From your earlier comment:

tommynego95:
I' m currently using this library:
GitHub - jrowberg/i2cdevlib: I2C device library collection for AVR/Arduino or other C++-based MCUs

As a base for my program i ' m using the pre-existing example "MPU6050_DMP6" contained inside MPU6050 library of the file i linked above.

it sounds like that's the library you intended to use.

When two libraries contain a header file matching an #include directive in your program, the Arduino build system has to pick one of the libraries to use. It usually is able to guess the right on, but in this case it guessed wrong and used this library:
C:\Users\tommy\OneDrive\Documents\Arduino\libraries\mpu6050-master
This library appears to be written by a 3rd party project, who has bundled the I2Cdev library inside their mpu6050 library. Unfortunately, you have another instance of multiple libraries with header files that match an #include directive:

Multiple libraries were found for "I2Cdev.h"

 Used: C:\Users\tommy\OneDrive\Documents\Arduino\libraries\I2Cdev

 Not used: C:\Users\tommy\OneDrive\Documents\Arduino\libraries\mpu6050-master

Again, the Arduino build system had to guess which to use, and picked this one:
C:\Users\tommy\OneDrive\Documents\Arduino\libraries\I2Cdev

So you now have the I2Cdev library from here being compiled along with the copy of the library bundled with the library at C:\Users\tommy\OneDrive\Documents\Arduino\libraries\mpu6050-master. This is the cause of those "multiple definition of" errors.

If you don't need both MPU6050 libraries, the easy fix is to simply delete the one you're not using. If you really do need both libraries, I can investigate what would be the best fix.

You solved it!
I' m so thankful.
I didn' t knew arduino IDE changed libraries path..
I was suspecting and "interference" between libraries and kept scrolling where old libraries where installed but couldn' t find any clue of MPU6050 headers conflicting.

Thanks again and have a good day.

You're welcome. I'm glad to hear it's working now. Enjoy!
Per

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