Compiling SDL 2.0 with MinGW


I tried to compile the latest SDL 2.0 snapshot with MinGW on Windowns 8.
However, I’m having some problems with this.
When I first built SDL 2.0, I got an error saying that it wasn’t built with force feedback support when running my program with it.
So I thought that I probably needed some DirectX headers for it to work correctly (and of course to get the better dsound backend).
Thus I copied the DirectX development headers and libraries from .
But then I got an error message saying that the file “wbemcli.h” was missing. I copied this header and “xinput.h” from the mingw-w64 project, but the headers don’t seem to be compatible as I get a lot of error messages like this one:
c:\mingw\bin…/lib/gcc/mingw32/4.7.2/…/…/…/…/include/wbemcli.h:499:80: error: unknown type name ‘VARIANT’

Do you know how I could solve these problems or do I have to use the MinGW version from mingw-w64 instead?
Thank you for your answers in advance!

To compile using normal MinGW (I’m only just now experimenting with MinGW-W64 right now), you only need a few files, which can be ripped from wine and patched slightly to work (in fact, this is basically what MinGW-W64 did).

Perhaps the Visual C++ headers include oaidl.h while the MinGW-W64 ones do not, causing SDL to have this error.

oaidl.h defines the VARIANT type. Including this before the offending header should do the trick.------------------------
Nate Fries

I tried to compile SDL with mingw-w64 now. Compiling has worked (I still need to test it with my program) but it seems that everything is the way it should be.

However, I had to apply a small change to the SDL source code: I had to remove the following lines from src/joystick/windows/SDL_dxjoystick.c:

DEFINE_GUID(IID_IWbemLocator, 0xdc12a687,0x737f,0x11cf,0x88,0x4d,0x00,0xaa,0x00,0x4b,0x2e,0x24);

because IID_IWbemLocator is already defined in the header file wbemcli.h.
Probably this should somehow be fixed in the source code.

I managed to compile SDL, SDL_image, … with mingw-w64 and the libraries work as expected.

But I’m a bit curious about using the header files from wine for mingw: What exactly has to be done to make them work?