I am having an issue with getting the ethernet libraries into eclipse. I have tried it a few different ways but it always fails on the linker. I saw another user posted that they had an Ethernet library they called similar to the core library but I cannot figure out how to make a library like that. I thought that including the header file in main.cpp would compile it into the project, do I also need to have a .a file containing the libraries for the linking?
The error I get is the following:
**** Build of configuration Debug for project EtherCan ****
make all
Building file: ../main.cpp
Invoking: AVR C++ Compiler
avr-g++ -I"D:\eclipse_workspace\arduino" -I"D:\eclipse_workspace\arduino\Ethernet" -I"D:\eclipse_workspace\EtherCan" -Wall -Os -fpack-struct -fshort-enums -funsigned-char -funsigned-bitfields -fno-exceptions -mmcu=atmega328p -DF_CPU=16000000UL -MMD -MP -MF"main.d" -MT"main.d" -c -o"main.o" "../main.cpp"
Finished building: ../main.cpp
Building target: EtherCan.elf
Invoking: AVR C++ Linker
avr-g++ --cref -s -Os -o "EtherCan.elf" ./main.o -lUnoCore -lm -Wl,-Map,EtherCan.map,--cref -L"D:\eclipse_workspace\arduino" -mmcu=atmega328p
./main.o: In function `main':
main.cpp:(.text+0x42): undefined reference to `Ethernet'
main.cpp:(.text+0x44): undefined reference to `Ethernet'
main.cpp:(.text+0x4e): undefined reference to `EthernetClass::begin(unsigned char*, unsigned char*)'
make: *** [EtherCan.elf] Error 1
Thanks,
Jeff
code for reference ... only one line so far.
// EtherCAN
#include <WProgram.h>
#include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x26, 0x34};
byte ip[] = {192, 168, 1, 122 };
int main(void) {
init();
Ethernet.begin(mac, ip);
while(1) {
}
}
extern "C" void __cxa_pure_virtual()
{
cli();
for(;;);
}
__extension__ typedef int __guard __attribute__((mode (__DI__)));
void * operator new(size_t size)
{
return malloc(size);
}
void operator delete(void * ptr)
{
free(ptr);
}
void * operator new[](size_t size)
{
return malloc(size);
}
void operator delete[](void * ptr)
{
if (ptr)
free(ptr);
}
int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);}
void __cxa_guard_release (__guard *g) {*(char *)g = 1;}
void __cxa_guard_abort (__guard *) {}