Compiling Problem: undefined reference to `main'

Hi,
I’m using SDL in my little software project. When I compiled my programs, the
compiler’s answer was:

/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/…/…/…/crt1.o(.text+0x18): In
function _start': ../sysdeps/i386/elf/start.S:77: undefined reference tomain’
collect2: ld returned 1 exit status

How do I compile my project in this case?

Could someone helps me, please?

Regards. Rona.

make sure your main is defined like this:

int main(int argc,char **argv)
{
//code here
}

sometimes i get that error and it’s because main is declared as returning
void or doesnt have the args (im on mingw for windows).> ----- Original Message -----

From: r_nappi@yahoo.it (Roberto Nappi)
To:
Sent: Friday, April 30, 2004 11:17 AM
Subject: [SDL] Compiling Problem: undefined reference to `main’

Hi,
I’m using SDL in my little software project. When I compiled my programs,
the
compiler’s answer was:

/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/…/…/…/crt1.o(.text+0x18): In
function _start': ../sysdeps/i386/elf/start.S:77: undefined reference to main’
collect2: ld returned 1 exit status

How do I compile my project in this case?

Could someone helps me, please?

Regards. Rona.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi,
I’m using SDL in my little software project. When I compiled my programs, the
compiler’s answer was:

/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/…/…/…/crt1.o(.text+0x18): In
function _start': ../sysdeps/i386/elf/start.S:77: undefined reference to main’
collect2: ld returned 1 exit status

How do I compile my project in this case?

Could someone helps me, please?

Are you sure you are linking in the correct libraries, in the correct order?

Sounds like you are missing a library at compile time - what is your compile
command line or makefile? Are you using autotools?–

Stefan Viljoen
Software Support Technician
Polar Design Solutions