Eclipse libraries not linking

Hi

I have been trying to build a project in Eclipse, and I have now got everything building correctly, and all the libraries are specified correctly, however, when the linker runs I get the errors:

D:\Arduino\workspace\fat16\Release\libfat16.a(SdCard.o): In function spiSSLow()': SdCard.cpp:(.text+0x1c): undefined reference todigitalWrite' D:\Arduino\workspace\fat16\Release\libfat16.a(SdCard.o): In function spiSSHigh()': SdCard.cpp:(.text+0x26): undefined reference todigitalWrite' D:\Arduino\workspace\fat16\Release\libfat16.a(SdCard.o): In function SdCard::init(unsigned char)': SdCard.cpp:(.text+0x362): undefined reference topinMode' SdCard.cpp:(.text+0x36a): undefined reference to pinMode' SdCard.cpp:(.text+0x372): undefined reference todigitalWrite' SdCard.cpp:(.text+0x37e): undefined reference to `pinMode'

I have 7 projects (trying to build the TinyWebServer) split up into 5 libraries (ArduinoCore, Ethernet, EthernetDHCP, fat16 and Flash) and 2 application projects (Blinky and WebServer).

The blinkey application compiles, links and uploads fine to the Arduino Uno, however, either the WebServer project is not linking correctly to the ArduinoCore library or the ArduinoCore library is not being compiled correctly (though the Blinky application links correctly to it).

I know the ArduinoCore library is linking to the WebServer project as it is in the linker command line: avr-g++ --cref -s -Os -o"WebServer.elf" -lm -Wl,-Map,WebServer.map,--cref -L"D:\Arduino\workspace\ArduinoCore\Release" -L"D:\Arduino\workspace\Ethernet\Release" -L"D:\Arduino\workspace\EthernetDHCP\Release" -L"D:\Arduino\workspace\fat16\Release" -L"D:\Arduino\workspace\Flash\Release" -mmcu=atmega328p ./TinyWebServer.o ./main.o ./sample.o -lArduinoCore -lEthernet -lEthernetDHCP -lfat16 -lFlash

and if I specify the wrong library (putting an X on the end) I get an error saying the library cannot be found.

Does anyone have any ideas as to why this is not working, is there a problem getting C++ libraries linking to C code in other libraries? I have tried copying the ArduinoCore code into my WebServer project and this works correctly, but I consider this to be a hack (in the same way copying the library from the Arduino IDE is a hack).

Cheers Keith

D:\Arduino\workspace\fat16\Release\libfat16.a(SdCard.o): In function spiSSLow()': SdCard.cpp:(.text+0x1c): undefined reference todigitalWrite' : ./TinyWebServer.o ./main.o ./sample.o -lArduinoCore -lEthernet -lEthernetDHCP -lfat16 -lFlash

Arrange for "ArduinoCore" to be mentioned AFTER the other libraries... I think the way you have it now, digitalWrite() isn't mentioned in your sketch itself, so it isn't loaded when the linker gets to -lArduinoCore. Then (later) the Ethernet libraries DO use digitalWrite, but it's too late...

Thank you for that, it's a while since I used C/C++ (I write in Java now) and I am used to the dependencies being the other way round!