PDA

View Full Version : undefined reference to `main'



Svartvit
August 26th, 2005, 08:40 PM
My computer is acting strange. Sometimes, in no particular pattern, g++ won't let me compile even the simplest of Hello World codes, and sometimes everything works as smooth as it comes. The complete error message I get is:

dogen@zazen:~/programming/s2gdb$ g++ s2gdb.cpp -o s2gdb
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../crt1.o(.text+0x18): In function `_start':
../sysdeps/i386/elf/start.S:98: undefined reference to `main'
collect2: ld returned 1 exit status
which doesn't make any sense to me at all, since I have plenty of main() function in my HelloWorld.cpp. Googling is futile. What the heck?

PS. Jaegermeister and Beer rocks. \\:D/

LordHunter317
August 26th, 2005, 09:06 PM
You didn't tell it to complie HelloWorld.cpp, hence it didn't try and didn't find a main().

Svartvit
August 26th, 2005, 09:09 PM
You didn't tell it to complie HelloWorld.cpp, hence it didn't try and didn't find a main().
No, you're right, I told it to compile s2gdb.cpp

tommie-lie
August 27th, 2005, 05:37 PM
Is there a main function (with the correct signature) in s2gdb.cpp?

rfrayer
November 5th, 2008, 12:57 AM
its funny ive seen this error all opver the place for varioue programs for me i get that exact same error trying to compile any version of gyachi and variouse other errors similer that there just isnt any answers for when it comes to other programs.

This is with Ubuntu Ibex mind you. Now im not by any means saying ibex sucks or anything because it does run nice and smooth... no boot errors etc. But there is a problem. Ive seen a load of bug reports just flat closed and say answered with absolutely no answer to them so obviousely someone must know a fix to this because as time goes on and hardy looses its upgrade support and attention and we (Paying Dell Customers) caugh cagh have to upgrade in order to continue getting support. This situation will suck on so many levels.

escapee
November 5th, 2008, 04:00 AM
rfrayer, all that error means is that the source containing the main function was not linked against the rest of the code. It is not an error in Ibex, settle down. Nothing is wrong, someone just forgot link in the file or the makefile you are using is broken.

rfrayer
November 5th, 2008, 12:36 PM
oh dont get me wrong im not hyped about it. Ive successfully compiled the exacdt same source code in hardy, gutsy, breezy etc and that error didnt exist. Im allmost wondering if i need to maybe export a different gcc version before i click make or something or if maybe it has something installed extra that checks for errors in the make file that were automaticly skipped in hardy.

Im allmost wondering if this might help anyways im gonna try it later and see

export CC=gcc-3.4 or 2.0 one of em


Ubuntu ingeneral even ibex is still by far the best linux distro in my opinion and Im sure we would all agree blows winblows xp, vesta etc out of the water.