I'm trying to install SDL on MinGW.
I've downloaded SDL from here (the SDL2-devel-2.0.0-mingw.tar.gz
link), then copied the contents of SDL2-2.0.0/x86_64-w64-mingw32/{bin,include,lib}
into the matching directories in my MinGW installation.
When I try to compile any file that contains #include ‹SDL2/SDL.h›
using gcc test.c -lmingw32 -lSDL2main -lSDL2 -mwindows
, GCC complains about undefined reference to WinMain@16
and undefined reference
to some SDL functions.
SDL2-devel-2.0.0-mingw.tar.gz
contains both 32-bit libraries (i686-w64-mingw32
directory) and 64-bit libraries (x86_64-w64-mingw32
directory).
The error was caused by using a 64-bit version of the library with a 32-bit compiler.