I'm trying to use SDL in C++ with Visual Studio 2008 Express. The following program compiles but does not link:
#include <SDL.h>
int main(int argc, char *argv[])
{
return 0;
}
The link error is:
LINK : fatal error LNK1561: entry point must be defined
I get this regardless of how or if I link with SDL.lib and SDLmain.lib. Defining main
as main()
or SDL_main()
gives the same error, with or without extern "C"
.
Edit: I solved this by not including SDL.h in main.cpp - a refactoring I did independent of the problem. A similar solution would be to #undef main
right before defining the function.