Search code examples
mingwwindows-xp

Mingw GCC cross compilation for windows XP


I need to compile a DLL on Windows 10 which will need to be usable on Windows XP.

The code compiles using Mingw GCC (and not using MSVC) and I don't know which version of mingw to use.

Is mingw GCC still compatible with windows XP (if yes does it need specific flags during compilation)?

If not, is there somewhere an information indicating on which version the windows XP support was dropped (I could not find any informations in the changelog)?


Solution

  • First of all Windows XP is no longer supported or updated by Microsoft itself and should be considered a security risk if you still use it.

    To compile for older Windows versions with MinGW you need to define _WIN32_WINNT to an older version for (0x0501 for Windows XP) when compiling your application as well as all of it's dependencies, including the standard library provided by MinGW.

    So in essence you need a MinGW compiler that was itself built to support Windows XP and build your application and any libraries it may depend upon with it.