Skip to main content
GameDev.net gamedev.net
🔒 Locked

Another SDL "Entry point must be defined" error.

Started by Drakkcon Oct 7, 2007 at 3:03 PM 6 replies 2.8k views
Original Post
Drakkcon
Drakkcon
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?
Lazy Foo
Lazy Foo
Did you link against both sdl.lib and sdlmain.lib?
Learn to make games with my SDL 2 Tutorials
Atridas
Atridas
You have to use the SDL_main instead of main or winmain or wethever

int SDL_main( int argc, char* args[] ){return 0;}
Drakkcon
Drakkcon
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.
SiCrane
SiCrane
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.
Drakkcon
Drakkcon
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?
SiCrane
SiCrane
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.