Issues with compile failure: twi.h: No such file or directory

Status
Not open for further replies.

CodeWarrior

New member
I am using the Arduino 1.8.11 IDE + the Teensyduino 1.50 on a Windows 10 machine.

I was using an Arduino UNO to interface with an MPU-6050 and the Keuwlsoft Bluetooth Electronics Android app. I quickly ran out of RAM and cast about looking for something with more memory. The Teensy 3.2 looked like an incredible value in a small size so I picked one up. Got the Blink program running along with interface to the Android and took the next step of setting up the I2C interface with the MPU-6050 (GY-521 'board). This is where my my elation and joy over finding such a nice part to work with came to a screeching halt- I continually get errors when compiling with the wire.h library. To simplify my request for assistance I pared the program down to its most basic form so as to focus on the issue at hand:

#include <Wire.h>
void setup(){}
void loop(){}

This yielded the following compiler output. The verbose output is also attached if it's of any help:

Multiple libraries were found for "Wire.h"
C:\Users\codew\Documents\Arduino\libraries\Wire\utility\twi.c:25:24: fatal error: compat/twi.h: No such file or directory

Used: C:\Users\codew\Documents\Arduino\libraries\Wire
compilation terminated.

Not used: C:\Program
Error compiling for board Teensy 3.2 / 3.1.


I read MogaRaghu's post on a similar issue (https://forum.pjrc.com/threads/42466-Forcing-the-Arduino-IDE-to-use-the-right-libraries) but I couldn't find a clear solution to my compile issue. I also did multiple internet searches but to no avail. Including/replacing with the i2c_t3.h library did not yield code which would compile either. For what its worth I have no problem compiling and running code which uses the wire.h library on the 'UNO, although this is not entirely surprising either. Any help which could be offered would be greatly appreciated!
 

Attachments

  • Verbose compile output.txt
    4.8 KB · Views: 75
Used: C:\Users\codew\Documents\Arduino\libraries\Wire

Delete or move this not-for-Teensy copy of Wire out of your Documents / Arduino / libraries folder.

Arduino lets you override any library by placing a copy in that folder. It's meant to let you experiment with hacking libs. But when you put a copy of a non-Teensy library there (perhaps long ago & forget about it) and then try to use Teensy, this Arduino feature meant to "help" you experiment with programming libraries becomes rather unhelpful.

The "Multiple libraries were found" message tries to inform you about the conflict, but sometimes what to do isn't perfectly clear. Hopefully this explanation helps?

Just delete that copy of Wire or move it somewhere else on your PC where it won't interfere.
 
Happy camper now

Delete or move this not-for-Teensy copy of Wire out of your Documents / Arduino / libraries folder.
I did as you recommended and it compiles fine now. Thank you for taking the time to help and explain the issue. I should have tried this to begin with but I guess I was surprised to think that such a basic, auto-installed, Arduino library had to be removed in order for I2C-based Teensy code to compile. Thanks again for all of your hard work and dedication to the Teensy ecosystem!
 
Thank you Paul, this "helpful" feature got me too but fortunately there are geniuses like you to help us less nurdy guys :)
 
Status
Not open for further replies.
Back
Top