View Full Version : Pretty newbie SDL question.

09-23-2002, 12:27 AM
sorry, but its late at night and i dont know why i am getting the following error when trying to compile an SDL app

[Linker error] undefined reference to `WinMain@16'

now, i have -lsdl in the compiler options, and i have included the sdl lib and all, got the dll's in the system dir, got all the libs in the library dir and all the headers in the righ place, i got now idea why it aint woerking...
more specifically:

Executing gcc.exe...
gcc.exe "C:\SDL-1.2.4\test\testoverlay.c" -o "C:\SDL-1.2.4\test\testoverlay.exe" -lsdl -s -I"C:\DEV-CPP\include" -L"C:\DEV-CPP\lib"
C:\DEV-CPP\lib/libmingw32.a(main.o)(.text+0x7f):main.c: undefined reference to `WinMain@16'

Execution terminated

[This message has been edited by MrShoe (edited 09-23-2002).]

09-23-2002, 03:13 AM
You need to add -lmingw32 at the beginning of your list of linker libraries.

See http://www.clg-net.com/ai/cprogramming.htm for more details.


09-23-2002, 03:27 PM
Thank GOD it worked http://www.opengl.org/discussion_boards/ubb/smile.gif thanks mate, and i was sitting hee at 2am in the morning thinking i was a complete jackass... i was even thinkning of joining the dark side and opening up VC6 http://www.opengl.org/discussion_boards/ubb/smile.gif
btw, i had to inlucde sdlmain as well in the linking for it to work fully.

09-24-2002, 10:29 AM
Glad it worked. I cannot tell you how long I spent trying to get the right libraries setup in the linker options...and in the correct order as well. :-(

Dev-C++, OpenGL, GLUT and SDL are pretty cool when they are configured correctly. ;-)