Society of Robots - Robot Forum
Software => Software => Topic started 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
-
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.
-
I had the problem with C
-
Could you please post your source code? I think I've found a solution.
-
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 :)