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

Entry point and SDL

Started by janta May 21, 2006 at 2:29 PM 0 replies 950+ views
Original Post
janta
janta
Hello, I.m trying to setup a starting project that will use SDL, but it seems it wont work du to some SDL entry point re-mapping. So basically my source file is:

#include <SDL.h>

int main(int argc, char *argv[])
{
	return 0;
}



the build log is:

------ Rebuild All started: Project: Motus, Configuration: Debug Win32 ------
Deleting intermediate and output files for project 'Motus', configuration 'Debug|Win32'
Compiling...
main.c
Linking...
LINK : fatal error LNK1561: entry point must be defined
Motus - 1 error(s), 0 warning(s)
I'v already read this topic (will open on a new window) but it did not help. I'm not too newbie relative to visual c++ (express), so I guess I've set up the project almost rightly. - Include directories: I:\sdk\SDL\include - Lib Directories: I:\sdk\SDL\lib - Additionnal dependencies: SDLmain.lib SDL.lib - The project is set to compile as C code (/TC) - Debug build, all optimization stuff is disabled - I've tried to add extern "C" to my main but it did not work either (error: string, of course, as C code. And as Cpp code the entry point is still not found, but I need my project to be plain C anyway) I hope I included all relevant information, and that someone can help me. Regards, Janta
janta
janta
So, I eventually fixed this, after couple hours tweaking with VC++ options.
I'm far far away from being an expert, so this is what was probably happenning, I guess.

SDL turn your main() into an SDL_main(), so your main is not the actual entry point any more.
So you need to inform your compiler about the target subsystem so as it can determine the appropriate entry point. (I don't have a deep understanding about that...)

So what fixed my problem with VC++ Express is set the SubSystem to Windows in
Properties -> Linker -> System -> SubSystem.

Maybe it could help someone, someday.

Topic Locked

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

Sign in to reply to this topic.