(SDL) "entry point must be defined" in init program

Started by
15 comments, last by minb2 14 years, 9 months ago
Thanks, but it still won't work. Waaah! I must be overlooking something exceedingly stupid...code's thus:
#pragma comment(lib, "SDLmain.lib")#pragma comment(lib, "SDL.lib")#include "SDL/SDL.h"int main(int argc, char* argv[] ) {		//Start SDL 	SDL_Init( SDL_INIT_EVERYTHING ); 		//Quit SDL 	SDL_Quit(); 	return 0; }
Advertisement
Don't forget (under Code Generation in project properties) to make it a Multithreaded [Debug] DLL. [smile]
I have multithreaded DLL set, but I did notice this:

1>LINK : warning LNK4044: unrecognized option '/lSDL'; ignored

the output window shaved it off; I'll see if I can figure out what I did wrong with that...
Alright, found out what was causing that error: I didn't get rid of the -lSDL flag before I added the #pragma comments. Which still brings me back to where I started ;_; *sigh...* thanks again for bearing with me.
Quote:Original post by kloffy
What IDE are you using?
In Visual C++ Express this is the way to go:
File -> New -> Project...Win32 -> Win32 Console Application -> OkApplication Settings -> Windows Application                        Empyt Project -> Ok

I hope this is understandable...

Edit:
Well, did you try creating a new project like I explained above? I just copied your code into my project and it worked. I'm sure it has something to do with the way you setup your project, because I had that error, too...
(You have to add SDL.lib and SDLmain.lib to your dependencies as well, but I think you did that already anyways...)

One more thing:
Perhabs you'll have to do this first, to be able to select "Windows Application". Good luck!



Well I was right: I was doing something stupid--I didn't read your post closely enough! I skimmed "empty project" and said to myself "I did choose an empty project" and left it at that. Moral of the story? No skimming :D

I am curious though--what difference did making the project that way make? there were still no files in the project, and the linker settings etc. appeared to be the same...But it works. Thank you thank you thank you so much.
For anyone else that might stumble across this thread. The answer is that in the project properties panel Linker -> System -> SubSystem must be set to "Windows (/SUBSYSTEM:WINDOWS). I can't remember exactly why it's necessary, but it probably has something to do with the linker treating WinMain() as the entry point instead of main().

Good luck.
Hi!

I've read the whole thread because I had the same error message. I applied all recommendations given and it still doesn't work (even with Windows as a subsystem). Does anyone know?

This topic is closed to new replies.

Advertisement