Another SDL "Entry point must be defined" error.

Started by
6 comments, last by SiCrane 16 years, 7 months ago
Okay, this error seems pretty common, so I've been searching for solutions for the past hour and none have helped. I am using Visual C++ 2005 and SDL, and getting the error "LNK1561: entry point must be defined". Now: -I have linked against sdlmain.lib -I am using a multi-threaded debug .dll for my C runtime -I have tried both unicode and multibyte character sets -I have made sure that I am using the proper version of the library (VC8) -I have set up my project as a Win32 project, empty, with no precompiled headers -I am about to slam my keyboard into my monitor. So can anyone tell me what else there is to do?
Advertisement
Do you use main() or WinMain()?
Did you link against both sdl.lib and sdlmain.lib?

Learn to make games with my SDL 2 Tutorials

You have to use the SDL_main instead of main or winmain or wethever

int SDL_main( int argc, char* args[] ){return 0;}
I have linked with sdl.lib and sdlmain.lib.

My main function looks like this:

int main(int, char**) { return 0; }

Edit: Using SDL_main doesn't fix the problem.
As a last resort, if you've downloaded the SDL source, you can try adding SDL_win32_main.c from the src/main/win32 directory to your project.
Wow, SiCrane, that worked perfectly! I'm not really sure why this is necessary though. Shouldn't SDL_Win32_main.o be linked in with sdlmain.lib? Why do I have to do this manually? Would the problem also be fixed if I built the source from scratch instead of downloading the precompiled VC8 library?
Quote:Original post by Drakkcon
Shouldn't SDL_Win32_main.o be linked in with sdlmain.lib?

Yes, it should. (Well .obj and not .o, but you get the idea.)
Quote: Why do I have to do this manually?

I've no idea.
Quote:Would the problem also be fixed if I built the source from scratch instead of downloading the precompiled VC8 library?

It's worth a shot. IIRC, the SDL people have released bum binary distributions before, but usually they fix it pretty quickly. Then again, I don't have any first hand experience with that; I always build the distribution from source and have never had any problems like this.

This topic is closed to new replies.

Advertisement