我正在使用Ubuntu 13.04并使用安装了mingw-w64 apt-get install mingw-w64.我可以使用以下命令编译和链接我的程序的64位工作版本:
x86_64-w64-mingw32-g++ code.cpp -o app.exe
Run Code Online (Sandbox Code Playgroud)
这会生成一个64位的app.exe文件.
我使用什么二进制或命令行标志来生成32位版本的app.exe?
我有一个简单的程序,可以使用MinGW的C / C ++库成功地使用clang进行编译:
#include <stdio.h>
int main(int argc, char **argv) { printf("Hello world!\n"); return 0; }
Run Code Online (Sandbox Code Playgroud)
我能够使用mingw-gcc成功编译此代码:
$ gcc test.c -o test
$ ./test
Hello world!
Run Code Online (Sandbox Code Playgroud)
我也可以使用clang + mingw成功编译它:
$ clang test.c -o test -target
$ ./test
Hello world!
Run Code Online (Sandbox Code Playgroud)
但是,如果我对程序(包括float.h)进行了少量更改,它将继续使用gcc进行编译,但不再使用clang进行编译:
#include <stdio.h>
#include <float.h>
int main(int argc, char **argv) { printf("Hello world!\n"); return 0; }
Run Code Online (Sandbox Code Playgroud)
$ gcc test.c -o test
$ ./test
Hello world!
$ clang test.c -o test -target x86_64-pc-windows-gnu
In file included from test.c:2:
In file included …Run Code Online (Sandbox Code Playgroud)