Problem with #include <SDL.h>

Are you saying you have a piece of code that compiles and links correctly. Then you add this single line:

#include “SDL.h”

and make no other changes, and it then fails to link with the error you describe?

Try renaming your code’s main() function to SDL_main().

Well, I don’t know C++, nor do I have a Windows machine.

The problem might be that SDL_main() or main() might need to be defined in a .c file (with C linkage), rather than in a .cpp file. Or something like that.

See if anything in SDL/include/SDL_main.h helps.

e.g. this looks informative:



  • \file SDL_main.h*
  • The application’s main() function must be called with C linkage,
  • and should be declared like this:
  • \code
  • #ifdef __cplusplus
  • extern “C”
  • #endif
  • int main(int argc, char *argv[])
  • {
  • }
  • \endcode

Don’t think I can say much more, I’ve already told you more than I know.

Good luck.