MinGW64 cannot compile 32bit code

旧时模样 提交于 2019-12-05 05:48:01

问题


I've downloaded MinGW from this link x64-4.8.1-posix-sjlj-rev1 but when I try to build for x86 target I've lots of linkage errors... seems that only x64 lib are installed...

I've need to build for x86 and x64 platforms on windows... Have I to download both x64 and x86 or are some simpler ways?

Edit I'm using eclipse keplero as IDE I've tryed to build myself a simple hello world program with g++ -m32 -std=c++11 test.cpp -o test32.exe and g++ -m64 -std=c++11 test.cpp -o test64.exe. And all is ok... So the problem was with eclipse... After a little a discovered that I need to use MYSY ( set in PATH ) and set -m32 also in the c++ linkage options...

Now all is fine.

I've also tryed to use NetBeans C++ as IDE... seems a gread IDE!!!


回答1:


It is not multilib enabled. That's why you are not able to compile 32-bit(x86) program. You can get multilib enabled toolchain from following link:

For 64-bit machine: 64-Bit

For 32-bit machine: 32-Bit



来源:https://stackoverflow.com/questions/17345584/mingw64-cannot-compile-32bit-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!