• 15
• 15
• 11
• 9
• 10

# Error in SDL program

This topic is 3700 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

When compiling an SDL program, I was getting an "unresolved external symbol" error, as well as a few warnings. The errors/warnings are: Warning 4 warning LNK4217: locally defined symbol _fclose imported in function _cleanup_output SDLmain.lib Warning 5 warning LNK4217: locally defined symbol _exit imported in function _main SDLmain.lib Warning 6 warning LNK4217: locally defined symbol _strrchr imported in function _main SDLmain.lib Error 7 error LNK2019: unresolved external symbol __imp__fprintf referenced in function _ShowError SDLmain.lib Error 8 fatal error LNK1120: 1 unresolved externals C:\Users\Andrew\Documents\Visual Studio 2008\Projects\OpenGLProgram\SDL\OpenGLProgram.exe I changed the "Runtime Library" property to "Multithreaded DLL", as I saw on the Internet, and these errors went away, replaced by this one: Error 1 fatal error LNK1561: entry point must be defined OpenGLProgram I am clearly defining an int main function as follows: int main(int argc, char *argv[]) which is what it said to do on the SDL page. Why isn't it working? EDIT: Yes, I am including SDL.h in my main.cpp file. [Edited by - EmrldDrgn on February 5, 2008 12:22:27 AM]

##### Share on other sites
I don't think I can determine the problem from all that info. I need you to be more vague.

##### Share on other sites
Try
int main(int argc, char** argv)

Also check that you're linking sdl.lib and sdlmain.lib

##### Share on other sites
Quote:
 Original post by SilentKillerTryint main(int argc, char** argv)Also check that you're linking sdl.lib and sdlmain.lib

char** argv is the same as char* argv[], so nothing would change.

To the original poster: Make sure you've setup SDL as described in this article: Setting up SDL in Visual Studio 2005

EDIT: I know you're using VS2008, but this article worked for me using VS2008 as well.

##### Share on other sites
If it is a console application the compiler expects a main(int,char**),
And if it is set to Win32 then you need to define WinMain.