SDL entry point Linker error in C++

Started by
8 comments, last by JonathanO'Brien 12 years, 10 months ago
My compiler is currently returning the following:
error LNK2001: unresolved external symbol __cedcl main(int, char**)

As its only error in Release. It appears to be having an issue with the SDL entry point main.
I have linked all necessary libraries and my runtime is set to /MD.

I receive no errors in debug and fail to understand what could be causing this error.

Thanks a bunch, GDN.
-A1P4A 0M3GA
Lead script writer on Scutum [http://www.gamedev.n...-entertainment/]
Team Member of [size=2]Forcas Entertainment
Amateur programmer with C++ and SDL knowledge
Game Enthusiast
Advertisement
Did you set the Subsystem to /Windows in the Debug configuration but forget to set it in the Release configuration?

Did you set the Subsystem to /Windows in the Debug configuration but forget to set it in the Release configuration?


Nope, the subsystem is windows.
-A1P4A 0M3GA
Lead script writer on Scutum [http://www.gamedev.n...-entertainment/]
Team Member of [size=2]Forcas Entertainment
Amateur programmer with C++ and SDL knowledge
Game Enthusiast
Are you linking in SDLmain.lib?

Are you linking in SDLmain.lib?


Yeah. I'm really stumped as to what the issue is.
-A1P4A 0M3GA
Lead script writer on Scutum [http://www.gamedev.n...-entertainment/]
Team Member of [size=2]Forcas Entertainment
Amateur programmer with C++ and SDL knowledge
Game Enthusiast
Can you paste the linker command line? I believe it is available somewhere in the Visual Studio linker settings. Consider investigating any differences between your Release and Debug linker command line as possible sources for this error.
Try changing your int main() or whatever you have to:

int main( int argc, char* args[] )

That should fix it. If not let me know.
Want to contact me directly?
Yahoo IM: code_miner

Can you paste the linker command line? I believe it is available somewhere in the Visual Studio linker settings. Consider investigating any differences between your Release and Debug linker command line as possible sources for this error.

Release

/OUT:"C:\Users\9101757\Documents\Visual Studio 2010\Projects\motion\Release\motion.exe" /NOLOGO "SDL.lib" "SDLmain.lib" "SDL_image.lib" "SDL_mixer.lib" "SDL_ttf.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"Release\motion.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\9101757\Documents\Visual Studio 2010\Projects\motion\Release\motion.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /PGD:"C:\Users\9101757\Documents\Visual Studio 2010\Projects\motion\Release\motion.pgd" /LTCG /TLBID:1 /ENTRY:"_cedcl main(int, char**)" /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE

Debug
/OUT:"C:\Users\9101757\Documents\Visual Studio 2010\Projects\motion\Debug\motion.exe" /NOLOGO "SDL.lib" "SDLmain.lib" "SDL_image.lib" "SDL_mixer.lib" "SDL_ttf.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"Debug\motion.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\9101757\Documents\Visual Studio 2010\Projects\motion\Debug\motion.pdb" /SUBSYSTEM:WINDOWS /PGD:"C:\Users\9101757\Documents\Visual Studio 2010\Projects\motion\Debug\motion.pgd" /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE
-A1P4A 0M3GA
Lead script writer on Scutum [http://www.gamedev.n...-entertainment/]
Team Member of [size=2]Forcas Entertainment
Amateur programmer with C++ and SDL knowledge
Game Enthusiast

/ENTRY:"_cedcl main(int, char**)"

Your release settings contains an explicit entry point, but your debug does not. A quick glance at the SDL documentation suggests to me that SDL provides the actual entry point as WinMain and "overloads" your own main function. Remove the entry point setting, unless there's a reason you've defined another entry point of course.
<br>[quote name='A1P4A_0M3GA' timestamp='1306968378' post='4818446']<br>/ENTRY:"_cedcl main(int, char**)" <br>
<br>Your release settings contains an explicit entry point, but your debug does not. A quick glance at the SDL documentation suggests to me that SDL provides the actual entry point as WinMain and "overloads" your own main function. Remove the entry point setting, unless there's a reason you've defined another entry point of course.<br>[/quote]<br><br>Thanks, that worked. I think I set that entry point because of advice I read elsewhere on the internet. Thankyou very much!
-A1P4A 0M3GA
Lead script writer on Scutum [http://www.gamedev.n...-entertainment/]
Team Member of [size=2]Forcas Entertainment
Amateur programmer with C++ and SDL knowledge
Game Enthusiast

This topic is closed to new replies.

Advertisement