Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

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

  1. #1
    Junior Member
    Join Date
    Feb 2020
    Location
    Farmington Hills (Detroit suburb), Michigan, USA
    Posts
    3

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

    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\ut ility\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...ight-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!
    Attached Files Attached Files

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,115
    Quote Originally Posted by CodeWarrior View Post
    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.

  3. #3
    Junior Member
    Join Date
    Feb 2020
    Location
    Farmington Hills (Detroit suburb), Michigan, USA
    Posts
    3

    Smile Happy camper now

    Quote Originally Posted by PaulStoffregen View Post
    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!

  4. #4
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,910
    Quote Originally Posted by CodeWarrior View Post
    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.
    blame the library - it does not consider other boards.

  5. #5
    Junior Member
    Join Date
    Feb 2020
    Location
    Farmington Hills (Detroit suburb), Michigan, USA
    Posts
    3
    My thoughts exactly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •