折腾了近1个半小时,才搞明白!希望后来者少走弯路!
1. 下载MinGW-W64(x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z):
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/
[该链接的上层目录(父目录)下面还有其它的MinGW-W64版本==GCC版本!]
点击进入Threads-posix —> seh —> 点击下载:x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z
MinGW-W64-8.1.0版完整下载地址链接:
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z
注:
a) gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0版是GCC编译器的最新版!
b) 如果电脑系统是 64位 的,选择 x86_64;如果是 32位的,则选择 i686 即可。
c) 如果要开发Windows程序,需要选择 win32;而开发 Linux、Unix、Mac OS等其他操作系统下的程序,则需要选择 posix。
d) 如果你之前选择了 64位,则这里有两个异常处理模型供你选择:seh是新发明的,而 sjlj 则是古老的。seh 性能比较好,但不支持 32位。 sjlj 稳定性好,支持 32位。
参考链接:
MinGW-w64安装教程——著名C/C++编译器GCC的Windows版本-CSDN博客
2. 解压下载的x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z文件,并将解压后的文件夹(mingw64)放到C:\下;再在系统环境变量中的“path”里面添加路径:C:\mingw64\bin。
3. 验证GCC编译器:
C:\Users\Administrator>gcc --version
gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\Users\Administrator>g++ --version
g++ (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4. 3种mingw-w64安装方法回顾评论:
上面是下载源文件,解压。。方法;还有通过msys2和mingw-w64-install.exe安装方法!我是在这2种方法安装问题多,一时找不到解决办法的情况下,就采用了第一种上面的方法!回顾安装过程:简单明了!安装的什么东东,自己清楚!