Compiler can't find included libraries for non standard boards

I’m having an issue where the IDE / compiler can’t find included libraries when using
ATtiny boards (ATtiny85)

For example the following sketch (Bare minimum)

#include <LiquidCrystal.h>
#include <Wire.h>

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

Results in the following compiler error:

/Users/********/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=16000000L -DARDUINO=10808 -DARDUINO_AVR_TINYX5 -DARDUINO_ARCH_AVR -I/Users/********/Library/Arduino15/packages/tiny/hardware/avr/1.0.6/cores/tiny /var/folders/nl/xzgr8cmj15g7g71x29xbz99w0000gn/T/arduino_build_435223/sketch/BareMinimum.ino.cpp -o /dev/null
/Users/********/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=16000000L -DARDUINO=10808 -DARDUINO_AVR_TINYX5 -DARDUINO_ARCH_AVR -I/Users/********/Library/Arduino15/packages/tiny/hardware/avr/1.0.6/cores/tiny -I/Applications/Arduino.app/Contents/Java/libraries/LiquidCrystal/src /var/folders/nl/xzgr8cmj15g7g71x29xbz99w0000gn/T/arduino_build_435223/sketch/BareMinimum.ino.cpp -o /dev/null
BareMinimum:2:18: error: Wire.h: No such file or directory
 #include <Wire.h>
                  ^
compilation terminated.

My added libraries (libraries in sketch_folder/libraries) work just fine. If I comment out “#include <Wire.h>” it compiles just fine.

Some background.

  • Arduino IDE 1.8.8.
  • Mac OS 10.14.2 (I only noticed this error after upgrading to Mojave)
  • My sketch folder is on a different hard drive from the Arduino app. I can’t see how this is related, but want to mention it.
  • I have deleted and re-installed both the ATtiny boards as well as the Arduino program. As well as verified the included libraries file path (Arduino.app > show package contents > etc.).
  • I do not have this issue if I select a “standard” Arduino board (Uno, Due, etc.).

I know for a fact that I did not have this issue the previous time I tried to used the ATtiny boards (I think before upgrading to Mac OS Mojave). I only discovered this issue when I tried to update the code for a project I did months ago (at which point I had no issues using the default libraries).

I guess I don’t fully understand how Arduino handles externally installed boards / libraries. Does this issue fall on the ATtiny board developer? Or am I (hopefully) missing something obvious?

Thanks for your help.

Does the attiny85 have an I2C interface?

Yes, it does.

According to the data sheet (pinout on page 2), pins 5 and 7 (PB0 and PB2) are SDA and SCL.

I know for a fact that my code has worked before because I'm using an I2C display.

Well I have a workaround that will certainly work for my needs.
I just copied the needed libraries (SPI and I2C) into my sketch libraries folder and included them with quotes

i.e. #include "Wire.h"

What ATtiny core did you install?

Compiles fine here, using DrAzzy's ATtinyCore to provide the Attiny85 support. Which "core" are you using?
Some libraries are chip-independent, in which case they are installed with the IDE. Others (like Wire.h) are more highly specialized, and need to be provided by the board package...

Okay, that helps. I installed "ATtiny extra Boards" By Leonardo Milliani. Version 1.0.6.

I tried a different core that includes ATtiny85, and that works perfectly. (I haven't seen any reference to Dr.Azzy's).

I guess because Wire and SPI aren't chip independent I shouldn't expect them to work for every chip without modification. I checked and libraries such as Servo or SoftwareSerial work fine.

Thanks!

(I haven't seen any reference to Dr.Azzy's).

Brilliant. I'll give it a whirl.

Thanks for your help!

gizmoguyar:
I guess because Wire and SPI aren't chip independent I shouldn't expect them to work for every chip without modification. I checked and libraries such as Servo or SoftwareSerial work fine.

Those functions are part of the Arduino core. If you use a third-party core they become the responsibility of the third-party core developers.