linker error using WINAVR and Eclipse Helios.

I am using Eclipse Helios for C/C++ and I have installed WinAvr which is installed at
I am trying to compile and link the following source:
------------------------------- test.c ---------------------------------

  • test.c
    #include <util/delay.h>
    #include <avr/io.h>
    #define LED PD4

int main(void) {
// define pd4 as output
DDRD |= (1 << LED);

while (1) {
PORTD |= (1 << LED); // switch on
PORTD &= ~(1 << LED); // switch off
return 0;
------------------------------------ end test.c ----------------------------------------------------

The source file compiles without issue however there is a linker problem.

Invoking: AVR Compiler
avr-gcc -Wall -g2 -gstabs -O0 -fpack-struct -fshort-enums -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega16u4 -DF_CPU=1000000UL -MMD -MP -MF"test.d" -MT"test.d" -c -o"test.o" “…/test.c”
Finished building: …/test.c

Building target: arduino.elf
Invoking: AVR C Linker
avr-gcc -Wl,-Map, -mmcu=atmega16u4 -o"arduino.elf" ./test.o
c:/winavr-20100110/bin/…/lib/gcc/avr/4.3.3/…/…/…/…/avr/lib/avr5/crtm16u4.o:(.init9+0x0): undefined reference to `main’
make: *** [arduino.elf] Error 1

This is obviously a configuration problem. I am missing library or a path to a library.
How do i configure the paths in Eclipse?


If you're using the AVR plugin for Eclipse, the options are in Properties -> C/C++ Build -> Settings.

Thanks for reply, What is the setting that should go in that field? black13

Depends where you have the files, of course (this is why it's not easy to help without more details).

this looks to be a pretty thorough tutorial, though.