1.6.11 Wire Example Does Not Build

Hi there

I'm trying to build the master reader wire example and get this error:

\Arduino\hardware\arduino\avr\libraries\Wire\src\Wire.cpp:437:20: fatal error: twi.h: No such file or directory

I looked at some other stuff about utils and src directories, in particular that utility must be in src (which it is), but no joy.

The same thing builds under 1.0.6 (which is the only thing I can move back to in a safe manner).

It will be about which locations the IDE uses to find things, but I have no idea how to fiddle with that, so any help gratefull appreciated.

Also builds in 1.6.12.

Maybe a little more info...

Board ?
OS ?
IDE version that fails ?
Boards versions for the IDE that fail ?

You didnt move anything around did you ?

I can’t reproduce this.

The error message:

indicates the issue occurs at line 437 of Wire.cpp but that file should only have 331 lines.

When you have an error you need to post the FULL output, not just the little snippet that you think might be relevant. When there is an error you’ll see a button on the right side of the orange bar “Copy error messages”. Click that button and then paste the error here USING CODE TAGS(</> button on the toolbar).


Thanks for your observations so far.

Here's the almost full 'verbose' error as requested by pert. It is almosy because "full" exceeds the allowable message length:

Arduino: 1.6.11 (Windows 10), TD: 1.30, Board: "Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)"

Compiling sketch...
"C:\Users\David\Documents\Arduino IDE\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR   "-IC:\Users\David\Documents\Arduino IDE\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Users\David\Documents\Arduino IDE\Arduino\hardware\arduino\avr\variants\eightanaloginputs" "-IC:\Users\David\Documents\Arduino IDE\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Users\David\AppData\Local\Temp\buildadc279cee6f8b9d73a2b1094473bd2ad.tmp\sketch\master_reader.ino.cpp" -o "C:\Users\David\AppData\Local\Temp\buildadc279cee6f8b9d73a2b1094473bd2ad.tmp\sketch\master_reader.ino.cpp.o"
Compiling libraries...
Compiling library "Wire"
"C:\Users\David\Documents\Arduino IDE\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR   "-IC:\Users\David\Documents\Arduino IDE\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Users\David\Documents\Arduino IDE\Arduino\hardware\arduino\avr\variants\eightanaloginputs" "-IC:\Users\David\Documents\Arduino IDE\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Users\David\Documents\Arduino IDE\Arduino\hardware\arduino\avr\libraries\Wire\src\Wire.cpp" -o "C:\Users\David\AppData\Local\Temp\buildadc279cee6f8b9d73a2b1094473bd2ad.tmp\libraries\Wire\Wire.cpp.o"
C:\Users\David\Documents\Arduino IDE\Arduino\hardware\arduino\avr\libraries\Wire\src\Wire.cpp:437:20: fatal error: twi.h: No such file or directory

   #include "twi.h""


compilation terminated.

Using library Wire at version 1.0 in folder: C:\Users\David\Documents\Arduino IDE\Arduino\hardware\arduino\avr\libraries\Wire 
exit status 1
Error compiling for board Arduino Pro or Pro Mini.

I don't know how to get the boards version.

I have also installed Teensyduino, if that is significant...


Get boards versions by going to TOOLS, BOARD, BOARDS MANAGER.

But that message suggests a missing or outdated library.

I think it must be something to do with Teensyduino because in my stock installation of Arduino IDE 1.6.11 Arduino\hardware\arduino\avr\libraries\Wire\src\Wire.cpp doesn’t even have 437 lines and the correct include is:

extern "C" {
  #include <stdlib.h>
  #include <string.h>
  #include <inttypes.h>
  #include "utility/twi.h"

#include "twi.h"
I don’t use Teensyduino. Teensys are great but I really wish they would use the standard 3rd party hardware system instead of some weird installation application. That makes me not want to install it to provide support. Luckily Paul does a great job providing support for his products. I would recommend checking the Teensy forum(https://forum.pjrc.com/), most likely this has already been asked, if not then they will definitely be able to help you out.


Thanks pert.

I'll check the Teensy forum - although this is another project which doesn't actually use the Teensy. For that, I use a different I2C library anyway....

Since it's not for Teensy you could try a stock installation of the IDE by using the "Windows ZIP file for non admin install" download. That will allow you to have your Teensyduino and regular Arduino IDEs installed at the same time. Another option would be to just install an unmodified version of the Wire library to your {sketchbook folder}\libraries folder, where it will override the version in the IDE installation. You can download it from http://downloads.arduino.cc/cores/avr-1.6.12.tar.bz2. The Wire library is at avr\libraries\Wire in that file.