Help - Search - Members - Calendar
Full Version: /crt1.o(.text+0x2c): undefined reference to `main'
OESF Forums > Distros, Development, and Model Specific Forums > Everything Development > Linux Applications
cmisip
I am trying to compile xu4. I get this error using gcc 2.95.3

/usr/local/bin/arm-linux-gcc -DHAVE_BACKTRACE=1 -DHAVE_VARIADIC_MACROS=1 -Wall -I. -I/home/cmisip/develop/usr/local/include -I/home/cmisip/develop/usr/local/include/SDL -DQWS -D_REENTRANT -Dmain=SDL_main -I/home/cmisip/develop/usr/local/include/libxml2 -DICON_FILE="/usr/local/share/pixmaps/u4.bmp" -DVERSION="0.9" -ggdb -rdynamic -o dumpsavegame util/dumpsavegame.o savegame.o io.o names.o
/usr/local/arm-linux/lib/crt1.o: In function `_start':
/usr/local/arm-linux/lib/crt1.o(.text+0x2c): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [dumpsavegame] Error 1


Anybody care to comment what is going on?

Thanks.
Mickeyl
Seems to be a SDL application. I recommend -lSDLmain
cmisip
/usr/local/bin/arm-linux-gcc -DHAVE_BACKTRACE=1 -DHAVE_VARIADIC_MACROS=1 -Wall -I. -I/home/cmisip/develop/usr/local/include -I/home/cmisip/develop/usr/local/include/SDL -DQWS -D_REENTRANT -Dmain=SDL_main -I/home/cmisip/develop/usr/local/include/libxml2 -DICON_FILE="/usr/local/share/pixmaps/u4.bmp" -DVERSION="0.9" -ggdb -rdynamic -ISDLmain -o dumpsavegame util/dumpsavegame.o savegame.o io.o names.o
/usr/local/arm-linux/lib/crt1.o: In function `_start':
/usr/local/arm-linux/lib/crt1.o(.text+0x2c): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [dumpsavegame] Error 1


I added -ISDLmain but get the same error.
cmisip
Does it help to say that xu4 was not meant to be compiled with gcc 2.95.x because of anonymous union structs (I changed those). The source files in u4/util compile fine on gcc 3.2.2. What changes does the makefile need?

Thanks again
Mickeyl
You did -ISDLmain while I recommended -lSDLmain
cmisip
Oh please elaborate. They look the same to me? And where do I put it?
Thanks.
Mickeyl
Uhm... it's two different letters. One is a uppercase I, as in Isadora, the other is a lowercase l as in library biggrin.gif
(The point where you placed it was ok)
cmisip
Here is what I got:

/usr/local/bin/arm-linux-gcc -DHAVE_BACKTRACE=1 -DHAVE_VARIADIC_MACROS=1 -Wall -I. -I/home/cmisip/develop/usr/local/include -I/home/cmisip/develop/usr/local/include/SDL -DQWS -D_REENTRANT -Dmain=SDL_main -I/home/cmisip/develop/usr/local/include/libxml2 -DICON_FILE="/usr/local/share/pixmaps/u4.bmp" -DVERSION="0.9" -ggdb -rdynamic -lSDLmain -o dumpsavegame util/dumpsavegame.o savegame.o io.o names.o
/usr/local/arm-linux/bin/ld: cannot find -lSDLmain
collect2: ld returned 1 exit status
make: *** [dumpsavegame] Error 1

The contents of my lib directory are:

libpng12.a libSDL.a libxml2.la
libpng12.so libSDL.la libxml2.so
libpng12.so.0 libSDLmain.a libxml2.so.2
libpng12.so.0.1.2.5 libSDL_mixer-1.2.so.0 libxml2.so.2.6.6
libpng.a libSDL_mixer-1.2.so.0.2.3 libz.so
libpng.so libSDL_mixer.a libz.so.1
libpng.so.3 libSDL_mixer.la libz.so.1.2.1
libpng.so.3.1.2.5 libSDL_mixer.so pkgconfig
libSDL-1.2.so.0 libSDL.so python2.2
libSDL-1.2.so.0.7.0 libxml2.a xml2Conf.sh
cmisip
On a positive note, compilation proceeds up to this point and creates a u4 binary drop in replacement to xu4 from http://inter.zon.free.fr/zaurus_index.htmlwhich runs on the zaurus 5600.

Dont know the long term consequences of this though. It runs and I am able to move, kill monsters and save the game.

I still would like to know where I am wrong.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.