且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用 gcc/g++ 在 Linux 上为 Windows 编译?

更新时间:2023-09-26 08:47:10

mingw32 作为 Linux 的一个包存在.您可以使用它交叉编译和链接 Windows 应用程序.在 Code::Blocks 论坛上有一个教程.例如,请注意命令更改为 x86_64-w64-mingw32-gcc-win32.

mingw32 exists as a package for Linux. You can cross-compile and -link Windows applications with it. There's a tutorial here at the Code::Blocks forum. Mind that the command changes to x86_64-w64-mingw32-gcc-win32, for example.

例如,Ubuntu 的存储库中有 MinGW:

Ubuntu, for example, has MinGW in its repositories:

$ apt-cache search mingw
[...]
g++-mingw-w64 - GNU C++ compiler for MinGW-w64
gcc-mingw-w64 - GNU C compiler for MinGW-w64
mingw-w64 - Development environment targeting 32- and 64-bit Windows
[...]