winapicompilationmingw-w6432-bittoolchain

Using MinGW to compile 32-bit modern applications on Windows


I wish to use MinGW to compile a 32-bit application from source that contains c++20. Thus, apparently OG MinGW won't cut it due to compiler support for modern C++, but I instead need to use MinGW-w64.

Try as I may, I cannot seem to get a working MSys that can locate the 32-bit version of MinGW-w64.

I have installed mingw-w64-i686-toolchain, but neither /bin nor /usr/bin seem to contain an appropriate GCC executable (I was looking for i686-w64-mingw32-gcc but nothing remotely similar was present). I'm assuming I need another command, but have tried google and stack overflow for hours with no inkling of what that might be.

What is the appropriate package to install in MSys and the appropriate name of the GCC executable?

Also, do I need to be in the MSYS2, MINGW32, or MINGW64 shell, or doesn't it matter?


Solution

  • I have installed mingw-w64-i686-toolchain, but neither /bin nor /usr/bin seem to contain an appropriate GCC executable (I was looking for i686-w64-mingw32-gcc but nothing remotely similar was present).

    MSYS2 store MSYS2 tools and mingw-w64 tools under different paths. This means you would have no luck trying to find native compilers under /bin nor /usr/bin; instead, you should be able to find tools targeting i686 under /mingw32/bin, and tools targeting AMD64 under /mingw64/bin or /ucrt64/bin.

    Also, do I need to be in the MSYS2, MINGW32, or MINGW64 shell, or doesn't it matter?

    You should use the MINGW32 shell to compile for an i686 Windows target.

    The w64 part of mingw-w64 is slightly misleading; while it adds the ability to target AMD64, the ability to target i686 is not removed.