Sign in to follow this  
JonathanO'Brien

SDL entry point Linker error in C++

Recommended Posts

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.

Share this post


Link to post
Share on other sites
[quote name='fastcall22' timestamp='1306909727' post='4818171']
Did you set the Subsystem to /Windows in the Debug configuration but forget to set it in the Release configuration?
[/quote]

Nope, the subsystem is windows.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Try changing your int main() or whatever you have to:

int main( int [url="http://en.wikipedia.org/wiki/Main_function"]argc[/url], char* args[] )

That should fix it. If not let me know.

Share this post


Link to post
Share on other sites
[quote name='rip-off' timestamp='1306934893' post='4818264']
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.
[/quote]
[b]Release[/b]

/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

[b]Debug[/b]
/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

Share this post


Link to post
Share on other sites
[quote name='A1P4A_0M3GA' timestamp='1306968378' post='4818446']
/ENTRY:"_cedcl main(int, char**)"
[/quote]
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.

Share this post


Link to post
Share on other sites
[quote name='Brother Bob' timestamp='1306970291' post='4818453']<br>[quote name='A1P4A_0M3GA' timestamp='1306968378' post='4818446']<br>/ENTRY:"_cedcl main(int, char**)" <br>[/quote]<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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this