Society of Robots - Robot Forum

Software => Software => Topic started by: GWER57 on December 06, 2009, 06:31:46 PM

Title: AVR Studio error
Post by: GWER57 on December 06, 2009, 06:31:46 PM
Hi :), I am having trouble right now with a program i am working on. For some reason, AVR Studio gives this error:
c:/program files/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr5/crtm328p.o:(.init9+0x0): undefined reference to `main'
Even if i delete the program in its entirety the error still comes up when compiling ???. The project i am working on involves an ATmega 328p. And as for my experience level i am pretty much a beginner, I have built one robot but the programming was basically cut and paste and tweaking to meet my needs as i am still trying to learn microcontrollers.

Thank you in advance for helping ;D
Title: Re: AVR Studio error
Post by: z.s.tar.gz on December 06, 2009, 08:45:16 PM
I had the exact same error, but I never solved it.
The problem is with avr-gcc though, I know that for sure.

Are you programming in asm or C? I had the problem with assembly.
Title: Re: AVR Studio error
Post by: GWER57 on December 07, 2009, 06:36:59 AM
I had the problem with C
Title: Re: AVR Studio error
Post by: z.s.tar.gz on December 07, 2009, 06:58:34 AM
Could you please post your source code? I think I've found a solution.
Title: Re: AVR Studio error
Post by: GWER57 on December 07, 2009, 07:05:11 AM
Here is my source code:

#include <avr/io.h>
#include <util/delay.h>
#include <uart.h>
#include <rprintf.h>

void display(int d1, int d2, int d3, int d4);

int main()
{
   uartInit();  // initialize UART
   uartSetBaudRate(38400);// set UART baud rate
   rprintfInit(uartSendByte);// initialize rprintf system

   for(int a = 0; a < 6; a++)
   {
      display(a, a+1, a+2, a+3);
      _delay_ms(1000);
   }
}

void display(int d1, int d2, int d3, int d4)
{
   rprintf("%d%d%d%d",d1,d2,d3,d4);
}


Thanks for the help :)