感觉好久没有更新了,随便水一篇吧。
今天想升级一下MinGW GCC,发现MinGW也好久没更新了,经过一番搜索发现MinGW-w64符合我的要求,安装过程也很简单。
1. 从这里下载在线安装器
2. 选择自己需要的配置

3. 选择安装路径

4. 完成安装

5. 设置环境变量

6. 在cmd或PowerShell中输入gcc -v, 出现正确的版本号表示安装成功
7. 写一段代码测试一下
#include <iostream> #include <any> #include <algorithm> #include <variant> using namespace std; template<typename... Args> int sum(Args&&... args) { return (0 + ... + args); } int main() { auto [a, b] = pair(1, 2.0); cout << sum(a, b, 3) << endl; auto x = any(3.14159); cout << any_cast<double>(x) << endl; variant<int, double> v; v = 123; cout << get<int>(v) << endl; v = 1.23; cout << get<double>(v) << endl; return 0; }
g++ a.cpp -std=c++17 ./a.exe
8. 大功告成
0
本文由kedixa发表于个人博客,
转载请注明作者及出处。
本文链接:https://blog.kedixa.top/2017/install-mingw-w64/