I2Cdev library error

Hi there,

I’m trying to install the I2Cdev library and having no luck. I have read through several similar queries online, (including this post https://forum.arduino.cc/index.php?topic=546597.0) and tried all the suggestions, but still no luck.

As recommended in the forum post, I downloaded the zip files from GitHub (GitHub - jrowberg/i2cdevlib: I2C device library collection for AVR/Arduino or other C++-based MCUs). I copied just the I2Cdev folder to my arduino sketchbook libraries and the library appears on the contributed libraries list.

However, when I run the sketch that includes the library I get a bunch of errors, including a fatal error for the I2Cdev library…

Arduino: 1.8.10 (Mac OS X), Board: “Arduino Nano, ATmega328P”

Multiple libraries were found for “SPI.h”
Used: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SPI
Multiple libraries were found for “RF24.h”
Used: /Users/jessicamardon1/Documents/Arduino/libraries/RF24
Multiple libraries were found for “Wire.h”
Used: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire
Multiple libraries were found for “I2Cdev.h”
Used: /Users/jessicamardon1/Documents/Arduino/libraries/I2CDev
In file included from /Users/jessicamardon1/Documents/Arduino/wireless instrument/transmitter-glove-code/transmitter-glove-code.ino:8:0:
/Users/jessicamardon1/Documents/Arduino/libraries/I2CDev/I2Cdev.h:37:10: fatal error: compiler_abstraction.h: No such file or directory
#include “compiler_abstraction.h”
^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino Nano.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Is there some way to fix this?

Best
Jess

You have installed the wrong version of the I2Cdev library. This library is a little more tricky to install than we are accustomed to because there are different variants of the library for different development "platforms" and all those variants of the library are together in the subfolders of a single repository. You installed the variant of the library for the nRF51 platform, but the correct variant would have been the one for the "Arduino" platform.

Do this:

  1. Delete /Users/jessicamardon1/Documents/Arduino/libraries/I2CDev. Please be very careful when deleting files from your computer. When in doubt, back up!
  2. Download the I2CDev library repository: https://github.com/jrowberg/i2cdevlib/archive/master.zip
  3. Unzip the downloaded file.
  4. Select Sketch > Include Library > Add .ZIP Library from the Arduino IDE's menus.
  5. Select the Arduino/I2Cdev subfolder of the i2cdevlib-master folder you unzipped from the download.
  6. Click the Open button.
  7. Wait for the Arduino IDE to show the status that the library was successfully installed.

Now you can try compiling or uploading your sketch again. You should no longer have the error you reported.

Fantastic, thanks so much, all working now

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

for arduino uno I am getting this error

ResolveLibrary(MPU6050.h)accelerometer_program:2:10: fatal error: MPU6050.h: No such file or directory

→ candidates: #include <MPU6050.h>

^~~~~~~~~~~

compilation terminated.

Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire
exit status 1
MPU6050.h: No such file or directory