网上的方法测试了, 不行。可能环境不一样吧。
网上的方法如下:
要确保已安装epel仓库,没有安装的话,执行
$ sudo yum install -y epel-release.noarch
$ yum clean all
$ yum makecache
安装编译器
$ sudo yum install -y mingw-filesystem-base.noarch
$ sudo yum install -y mingw64-gcc.x86_64 mingw64-gcc-c++.x86_64
执行结果如下:
[root@aabbcc ~]# yum install -y mingw-filesystem-base.noarch
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
No package mingw-filesystem-base.noarch available.
Error: Nothing to do
后来在github上找到一个项目:
https://github.com/Zeranoe/mingw-w64-build
下载后执行脚本,就会编译好整个工具链
[root@CentOS83]# ./mingw-w64-build x86_64
[root@CentOS83 mingw-w64-build-master]# ./mingw-w64-build x86_64
(1/20): d

本文介绍了如何在CentOS7.8系统中进行交叉编译,以生成适用于Windows的可执行文件。传统的网上方法未奏效,但通过GitHub项目Zeranoe/mingw-w64-build提供的脚本成功编译了工具链。执行脚本后,更新环境变量,即可使用x86_64-w64-mingw32-gcc等工具进行编译。
最低0.47元/天 解锁文章
16万+

被折叠的 条评论
为什么被折叠?



