Custom libraries linking problem

Hi,

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}
etc…
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!

Thanks;
Jan

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:
https://code.google.com/p/engduino/source/browse/#svn%2Ftrunk%2FEngduinov3%2Farduino-1.0.5-Engduino%2Flibraries

And sketch is under examples\100.Engduino\Protocol:
https://code.google.com/p/engduino/source/browse/trunk/Engduinov3/arduino-1.0.5-Engduino/examples/100.Engduino/Protocol/Protocol.ino

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.

Thanks;
Jan

Or, let's make it even simple:
I have also a branch with different structure:
So, this sketch compiles in 6.6KB:
https://code.google.com/p/engduino/source/browse/branches/arduino-1.0.5-Engduino-COMM/examples/100.Engduino/LightSensor/LightSensor.ino

and this one compiles in 13.4KB
https://code.google.com/p/engduino/source/browse/trunk/Engduinov3/arduino-1.0.5-Engduino/examples/100.Engduino/LightSensor/LightSensor.ino

All sources should be the same.

Thanks;
Jan