I'm developing a sketch which I need to run on an Uno (for debug) and a Gemma (as the target). Adafruit has their own Wire library (TinyWireM) which I was planning on using on the Gemma. Thus, I was trying to use #if's to automatically include the correct library for the given target board. However, it appears that the TinyWireM include files is always included even if the AVR_ATtiny85 macro symbol is undefined (I get many undefined symbols reported inside the Arduino\libraries\TinyWireM-master\USI_TWI_Master.cpp file). If I comment out the TinyWireM.h include statement (inside the #if define statement), then it compiles fine. Code example below.
So why isn't this include statement being skipped? I'm at a loss. Anyone have any thoughts?
Thx all.
Mike
#undef __AVR_ATtiny85__ // Debug only - making sure not defined.
#if defined (__AVR_ATtiny85__)
#include <TinyWireM.h> // Seems this file is still being included and
// must comment out this line when compiling
// code for an UNO. This should not be necessary
// given __AVR_ATtiny85__ is not defined.
#else
#include <Wire.h> // This is the Wire library for the Uno.
#endif
void setup() { }
void loop() { }