Archived

This topic is now archived and is closed to further replies.

Greg K

SDL under windows

Recommended Posts

I am using SDL under windows after using it (successfully) under linux. I am trying to port a program to windows. When I try to compile my code everything compiles fine and then I get a linker error saying: [Linker error] undefined reference to `WinMain@16'' I am using Dev-C++, Mingw32, SDL1.2. The project options in Dev-C++ say Win32 Console. Any help would be appreciated. -Greg

Share this post


Link to post
Share on other sites
Do I have to? Can I leave it as a console app? It says somewhere in the sdl doc that you should use a console app and let SDL do it''s init in WinMain that it defines itself. Also, what is the #define for windows? WIN32? _WIN32?

Share this post


Link to post
Share on other sites
This is covered in the SDL Windows FAQ at www.libsdl.org.

Q: I get "Undefined reference to ''WinMain@16''"
A: Under Visual C++, you need to link with SDLmain.lib. Under the gcc build environments including Dev-C++, you need to link with the output of "sdl-config --libs", which is usually: -lmingw32 -lSDLmain -lSDL -mwindows

Share this post


Link to post
Share on other sites