"Dual-target" MinGW-w64 isn't really dual-target? "Dual-target" MinGW-w64 isn't really dual-target? windows windows

"Dual-target" MinGW-w64 isn't really dual-target?


For those who are getting this linker error on linux with mingw, you are probably trying to build a 32 bit binary with the 64 bit compiler with the -m32 flag or the other way around it.

To fix this issue, just compile with i686-w64-mingw32 instead of x86_64-w64-mingw32.


Although the General Usage Instructions page on MinGW-w64 Wiki claims that the MinGW-builds project supplies dual-target compilers, this is not completely true anymore. The SEH variants (which come starting from GCC 4.8.0) are only single-target. You can see it yourself by inspecting the directory structure of their distributions, i.e. they contain only the libraries with either 64- or 32-bit addressing, but not both. Furthermore, recently it was confirmed on the mailing list of MinGW-builds.

On the other hand, plain old SJLJ distributions are indeed dual-target. If you get:

The application was unable to start correctly (0xc000007b). Click OK to close the application.

when running the 64-bit application produced by these distributions, then you should recall that 0xC000007B is the code of STATUS_INVALID_IMAGE_FORMAT, which is a good evidence that 64-bit application is trying to load 32-bit DLLs. Probably, you have added \bin to PATH, whereas should have added \i686-w64-mingw32\lib64 for 64-bit applications to run properly.