Very strange problem - library being included when not included!

Hi all,

I've been playing around with an ATTiny25 and managed to get it to toggle an output pin and blink an LED (programmed it with an AVRISPMKII).

Anyway, I installed the extra core files and added the "board" (CPU) definitions to the boards.txt file, and it all works great...... EXCEPT!

For some reason, one and only one of my libraries (a custom library for running a graphics VFD display) gets "included" somehow and of course throws all kinds of errors because the ATTiny25 doesn't know anything about the ports and pins that the graphic driver uses.

Here's a condensed listing of the errors I get (duplicates removed):

/usr/share/arduino-1.0.6/sketches/libraries/Noritake_GUU100/Noritake_GUU100.cpp:226:30: error: 'pgm_read_byte_far' was not declared in this scope
/usr/share/arduino-1.0.6/sketches/libraries/Noritake_GUU100/Noritake_GUU100.cpp:333:25: error: 'rad' was not declared in this scope
/usr/share/arduino-1.0.6/sketches/libraries/Noritake_GUU100/Noritake_GUU100.cpp:939:16: error: 'PORTC' was not declared in this scope
/usr/share/arduino-1.0.6/sketches/libraries/Noritake_GUU100/Noritake_GUU100.cpp:938:15: error: 'DDRC' was not declared in this scope
/usr/share/arduino-1.0.6/sketches/libraries/Noritake_GUU100/Noritake_GUU100.cpp:936:15: error: 'DDRA' was not declared in this scope
/usr/share/arduino-1.0.6/sketches/libraries/Noritake_GUU100/Noritake_GUU100.cpp:935:15: error: 'PINA' was not declared in this scope

Now, here's the source code ("test.ino") that I'm trying to compile... can't get much simpler than this:

#define BIT _BV (4);

void setup (void)
    DDRB |= BIT;

void loop (void)
    PORTB |= BIT;
    delay (500);
    PORTB &= ~BIT;
    delay (500);

Now, if I move the offending library out of "libraries", then the code compiles and uploads perfectly.

I can't imagine how or why this is happening. I even made sure to kill the IDE, clear out all the build files in /tmp (i.e. make sure some residual leftover object file wasn't lurking around), then re-started the IDE. Same problem.

Any suggestions on what I should look for? I could post the whole driver cpp and h files, but they're quite large. I don't think I'm doing anything "wrong" or "odd".....

Any ideas? I will greatly appreciate it.

P.S. I'm sure it's NOT an IDE problem because trying to compile the same code manually (using a Makefile) gives the exact same problem.

Could it be an recursive / indirect include?

It sounds like one of your other included Libraries have the errant-library ALSO included.

Check the .h and .cpp for all included Libraries and remove (REM it out) it if found. As long as the library is defined in your main sketch, if it is needed in an include, it should already be in the folder for compiling so removing it from subsequent Libraries should not present a problem.

robtillaart: Could it be an recursive / indirect include?

I found the problem today!

I build code both by using the IDE (just for the "Upload" button) as well as using a Makefile stand-alone.

Well, what happened was a few other sketches that I compiled using a Makefile still had their [b].lib[/b]directories (because I hadn't done a "make clean") and the object files (*.o)were still there and somehow they got included in a build of a completely different sketch!

After cleaning out all the sketch directories (by doing a [tt][b]find -iname '*.lib' -exec rm [/b]-r {} \;[/tt] ) , the problem went away and I could build any sketch I wanted without any problems.

Why the Arduino IDE seems to "scan" all the sketch directories and include everything it finds seems strange to me, but at least I found the problem and now it's fixed.