Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gcc compile error - undefined reference to `main`

Status
Not open for further replies.

ezeke1

Programmer
Mar 20, 2003
41
US
Hello All,
I'm getting some gcc compile errors and the compiler is complaining with this message;
/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'

I'm running redhat 9.0 and after some google searches, I found that people who had the same error may have an imcompatible gcc compiler. Can anyone help me understand what's happening?

Thanks,
David

 
Have you got a main() method ?
IE :

Code:
//entry point to application
int main() {

}

--------------------------------------------------
Free Database Connection Pooling Software
 
Actually I do not have a main() method. The code I'm compiling is a module that isn't a standalone program. I use to have a main.c which held the main method but that went away. So the compiler is looking for a main()?

Thanks,
David
 
sedj - I added a main method and the compile error went away. Thank you for catching that :)

David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top