Author Topic: AVR Studio error  (Read 3693 times)

0 Members and 1 Guest are viewing this topic.

Offline GWER57Topic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 2
AVR Studio error
« 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
GTW

Offline z.s.tar.gz

  • Supreme Robot
  • *****
  • Posts: 540
  • Helpful? 5
  • Linux Guru
Re: AVR Studio error
« Reply #1 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.
Save yourself the typing. Just call me Zach.

Offline GWER57Topic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 2
Re: AVR Studio error
« Reply #2 on: December 07, 2009, 06:36:59 AM »
I had the problem with C
GTW

Offline z.s.tar.gz

  • Supreme Robot
  • *****
  • Posts: 540
  • Helpful? 5
  • Linux Guru
Re: AVR Studio error
« Reply #3 on: December 07, 2009, 06:58:34 AM »
Could you please post your source code? I think I've found a solution.
Save yourself the typing. Just call me Zach.

Offline GWER57Topic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 2
Re: AVR Studio error
« Reply #4 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 :)
GTW

 


Get Your Ad Here

data_list