Go Down

Topic: Eclipse and Ethshield - linker fails (Read 3 times) previous topic - next topic


Feb 10, 2011, 02:52 pm Last Edit: Feb 10, 2011, 02:56 pm by endoracing Reason: 1
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:

Code: [Select]
**** 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


code for reference ... only one line so far.
Code: [Select]
// EtherCAN

#include <WProgram.h>
#include <Ethernet.h>

byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x26, 0x34};
byte ip[] = {192, 168, 1, 122 };

int main(void) {

  Ethernet.begin(mac, ip);

  while(1) {



extern "C" void __cxa_pure_virtual()

__extension__ typedef int __guard __attribute__((mode (__DI__)));

void * operator new(size_t size)
  return malloc(size);

void operator delete(void * ptr)

void * operator new[](size_t size)
    return malloc(size);

void operator delete[](void * ptr)
if (ptr)

int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);}
void __cxa_guard_release (__guard *g) {*(char *)g = 1;}
void __cxa_guard_abort (__guard *) {}

Go Up

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

shortcuts: alt+s submit/post or alt+p preview