Custom libraries linking problem


I have a quite unusual error, even if I’m coding in C for a while.

I discovered my problem by coincidence when one of my sketches runs out of space, after I changed only the file structure of my own libraries.

I’m using Arduino 1.0.5 and Atmega32u4.

Case 1: (separate folder for each Engduino library)
arduino/libraries/EngduinoLED/ {EngduinoLED.cpp, EngduinoLED.h, SPI.cpp, SPI.h}
arduino/libraries/EngduinoButton/ { EngduinoButton.cpp, EngduinoButton.h}
Result → size of test sketch (using some of that libraries) = 6KB.

Case 2: (common folder for all Engduino libraries)
arduino/libraries/Engduino/ {EngduinoLED.cpp, EngduinoLED.h, SPI.cpp, SPI.h, EngduinoButton.cpp, EngduinoButton.h , etc…}
Result → same sketch = 13KB!

Any explanation about it would be really appreciated!


Any explanation about it would be really appreciated!

Without seeing the sketch? Without seeing the libraries? Without being able to examine the resulting hex file? Not a chance.

Libraries are here:

And sketch is under examples\100.Engduino\Protocol:

With that file structure codes doesn’t compile, because it’s too large (29KB). But with different file structure, compiles without problems on size 24KB and also works without any problems.


Or, let's make it even simple:
I have also a branch with different structure:
So, this sketch compiles in 6.6KB:

and this one compiles in 13.4KB

All sources should be the same.