Re: Undefined Main Symbol
Re: Undefined Main Symbol
- Subject: Re: Undefined Main Symbol
- From: Jean-Daniel Dupas <email@hidden>
- Date: Tue, 1 Jun 2010 09:26:41 +0200
Le 1 juin 2010 à 06:46, Balajee R.C a écrit : I am running into the following linker error when trying to build a certain open source program:
Ld build/Debug/LincityNG3D.app/Contents/MacOS/LincityNG3D normal x86_64 cd /Users/balajeerc/Projects/LinCityNG/3d/LinCityNG3d /Developer/usr/bin/g++-4.2 -arch x86_64 -L/Users/balajeerc/Projects/LinCityNG/3d/LinCityNG3d/build/Debug -L/opt/local/lib -F/Users/balajeerc/Projects/LinCityNG/3d/LinCityNG3d/build/Debug -F/opt/local/Library/Frameworks -filelist /Users/balajeerc/Projects/LinCityNG/3d/LinCityNG3d/build/LincityNG3D.build/Debug/LincityNG3D.build/Objects-normal/x86_64/LincityNG3D.LinkFileList -framework Foundation -framework AppKit -framework SDL_ttf -framework SDL -lphysfs -lxml2 -framework OpenGL -lSDL_gfx -lSDL_image -lSDL_mixer -lz -o /Users/balajeerc/Projects/LinCityNG/3d/LinCityNG3d/build/Debug/LincityNG3D.app/Contents/MacOS/LincityNG3D
Undefined symbols: "_main", referenced from: start in crt1.10.6.o ld: symbol(s) not found collect2: ld returned 1 exit status
I have already checked the following:
1) That the file containing definition of main has been compiled successfully and that the object binary of the same is listed in the LinkFileList specified. 2) extern "C" has been used on main in case the compiler is unable to find the symbol in symbol table for the project thats mostly C++ code.
I am code-pasting the rather long compiler flags externally to keep the post readable: http://www.pasteall.org/13491I'd be grateful if someone can tell me what else I need to check for that might be possibly causing this error.
SDL defines a macro that change main function name into something else. If you downloaded SDL on the SDL web site, the disk image for OS X contains a devel-lite folder with SDLMain.m and SDLMain.h. This is the file that contains the true main function. You have to add this to you project to compile your software.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden