Link the libraries

You need to link with the output of sdl-config --libs:
-lmingw32 -lSDLmain -lSDL -mwindows
The order of the options is very important.

Pulled from

Use the correct main method

You will get this error if your main method is just

int main ()

It has to have the standard arguments

int main (int argc, char *argv[])

Include SDL.h

You also need to include SDL.h in the file that contains int main(int argc, char *argv[]) (even if you don't use SDL there)

FAQ_Undefined_Reference_to_SDL_main (last edited 2008-04-17 08:18:54 by localhost)