Go Down

Topic: IDE error compiling, Nano - MPU6050 (Read 151 times) previous topic - next topic

zeostjh

Aug 04, 2019, 03:13 pm Last Edit: Aug 04, 2019, 03:37 pm by zeostjh
when compiling the MPU6050 examples that come with  Jeff Rowberg library I now get an error.  Could someone please guide me in correcting this issue. I have reinstalled IDE and libraries with no success. this was working on this machine last week and don,t know whats changed to cause this.     below is the errors after trying to compile.  thank you



Code: [Select]
In file included from C:\Users\grego\Documents\Arduino\libraries\MPU6050\Examples\MPU6050_DMP6\MPU6050_DMP6.ino:48:0:

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h: In member function 'uint8_t MPU6050::dmpGetAccel(int32_t*, const uint8_t*)':

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:580:31: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[0] = ((packet[28] << 24) + (packet[29] << 16) + (packet[30] << 8) + packet[31]);

                              ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:580:52: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[0] = ((packet[28] << 24) + (packet[29] << 16) + (packet[30] << 8) + packet[31]);

                                                   ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:581:31: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[1] = ((packet[32] << 24) + (packet[33] << 16) + (packet[34] << 8) + packet[35]);

                              ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:581:52: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[1] = ((packet[32] << 24) + (packet[33] << 16) + (packet[34] << 8) + packet[35]);

                                                   ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:582:31: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[2] = ((packet[36] << 24) + (packet[37] << 16) + (packet[38] << 8) + packet[39]);

                              ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:582:52: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[2] = ((packet[36] << 24) + (packet[37] << 16) + (packet[38] << 8) + packet[39]);

                                                   ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h: In member function 'uint8_t MPU6050::dmpGetQuaternion(int32_t*, const uint8_t*)':

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:604:30: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[0] = ((packet[0] << 24) + (packet[1] << 16) + (packet[2] << 8) + packet[3]);

                             ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:604:50: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[0] = ((packet[0] << 24) + (packet[1] << 16) + (packet[2] << 8) + packet[3]);

                                                 ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:605:30: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[1] = ((packet[4] << 24) + (packet[5] << 16) + (packet[6] << 8) + packet[7]);

                             ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:605:50: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[1] = ((packet[4] << 24) + (packet[5] << 16) + (packet[6] << 8) + packet[7]);

                                                 ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:606:30: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[2] = ((packet[8] << 24) + (packet[9] << 16) + (packet[10] << 8) + packet[11]);

                             ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:606:50: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[2] = ((packet[8] << 24) + (packet[9] << 16) + (packet[10] << 8) + packet[11]);

                                                 ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:607:31: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[3] = ((packet[12] << 24) + (packet[13] << 16) + (packet[14] << 8) + packet[15]);

                              ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:607:52: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[3] = ((packet[12] << 24) + (packet[13] << 16) + (packet[14] << 8) + packet[15]);

                                                   ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h: In member function 'uint8_t MPU6050::dmpGetGyro(int32_t*, const uint8_t*)':

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:637:31: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[0] = ((packet[16] << 24) + (packet[17] << 16) + (packet[18] << 8) + packet[19]);

                              ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:637:52: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[0] = ((packet[16] << 24) + (packet[17] << 16) + (packet[18] << 8) + packet[19]);

                                                   ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:638:31: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[1] = ((packet[20] << 24) + (packet[21] << 16) + (packet[22] << 8) + packet[23]);

                              ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:638:52: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[1] = ((packet[20] << 24) + (packet[21] << 16) + (packet[22] << 8) + packet[23]);

                                                   ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:639:31: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[2] = ((packet[24] << 24) + (packet[25] << 16) + (packet[26] << 8) + packet[27]);

                              ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:639:52: warning: left shift count >= width of type [-Wshift-count-overflow]

    data[2] = ((packet[24] << 24) + (packet[25] << 16) + (packet[26] << 8) + packet[27]);

                                                   ^

C:\Users\grego\Documents\Arduino\libraries\I2Cdev\I2Cdev.cpp:64:14: warning: #warning Using current Arduino IDE with Wire library is functionally limiting. [-Wcpp]

            #warning Using current Arduino IDE with Wire library is functionally limiting.

             ^

C:\Users\grego\Documents\Arduino\libraries\I2Cdev\I2Cdev.cpp:65:14: warning: #warning Arduino IDE v1.0.1+ with I2CDEV_BUILTIN_FASTWIRE implementation is recommended. [-Wcpp]

            #warning Arduino IDE v1.0.1+ with I2CDEV_BUILTIN_FASTWIRE implementation is recommended.

             ^

C:\Users\grego\Documents\Arduino\libraries\I2Cdev\I2Cdev.cpp:66:14: warning: #warning This I2Cdev implementation does not support: [-Wcpp]

            #warning This I2Cdev implementation does not support:

             ^

C:\Users\grego\Documents\Arduino\libraries\I2Cdev\I2Cdev.cpp:67:14: warning: #warning - Timeout detection (some Wire requests block forever) [-Wcpp]

            #warning - Timeout detection (some Wire requests block forever)

             ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050.h:401:7: warning: type 'struct MPU6050' violates one definition rule [-Wodr]

class MPU6050 {

      ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050\MPU6050.h:401:7: note: a different type is defined in another translation unit

class MPU6050 {

      ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050/MPU6050.h:781:22: note: the first difference of corresponding definitions is field 'dmpPacketBuffer'

            uint8_t *dmpPacketBuffer;

                     ^

C:\Users\grego\Documents\Arduino\libraries\MPU6050\MPU6050.h:983:17: note: a field with different name is defined in another translation unit

        uint8_t devAddr;

                ^

ballscrewbob

See all those smileys in your post ?

That is what happens when you don't use code tags or read the firs few sticky posts.
Please do so now and re-do your post.

The forum chews up code unless you use code tags ( </> )

Bob.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.


pert

#3
Aug 05, 2019, 01:11 am Last Edit: Aug 05, 2019, 01:12 am by pert Reason: Fix markup
You have not posted any errors, only warnings.

You need to understand the difference between warnings and errors. A warning is the compiler telling you there is something in the code that could possibly cause a problem but doesn't cause the compilation to fail. An error is a problem with the code that causes compilation to fail. In this case you have posted warnings, not errors.

You should always pay attention to warnings and fix them in your own code whenever possible. Unfortunately some library authors don't hold themselves to such high standards so sometimes you do just need to ignore a warning from a library that you didn't write. That can be quite annoying since you are always having to sort though a bunch of warnings in other people's sloppy code to make sure your own code is of high quality. You may decide it's worth editing the source of the library to fix the warning. If you do so, it's a good idea to submit a pull request for the fix to the library's repository to solve the problem upstream, otherwise the warnings will come back whenever you update to a new release of the library. This will also benefit all the other users of the library.

Likely the reason you're seeing these warnings now but were not before is because you turned on the display of warnings at File > Preferences > Compiler warnings. I recommend that you always leave File > Preferences > Compiler warnings set to "All", but that you also take the time to understand what the compiler is trying to tell you instead of just freaking out "oh no there's an error!" every time you see a warning.

I have reinstalled IDE and libraries with no success.
That's interesting because this warning:
Code: [Select]

C:\Users\grego\Documents\Arduino\libraries\I2Cdev\I2Cdev.cpp:65:14: warning: #warning Arduino IDE v1.0.1+ with I2CDEV_BUILTIN_FASTWIRE implementation is recommended. [-Wcpp]

            #warning Arduino IDE v1.0.1+ with I2CDEV_BUILTIN_FASTWIRE implementation is recommended.

             ^

indicates that you're using a version of i2cdevlib that is years out of date. I would recommend updating to the latest version of both the MPU6050 and I2Cdev libraries downloaded from the official repository:
https://github.com/jrowberg/i2cdevlib

Go Up