访问 MinGW-w64 - for 32 and 64 bit Windows 页面,找到最新版的 x86_64-posix-sjlj
包,下载,并解压。(不要点击 Download Latest Version
, 会下载在线安装包, 安装很慢)
将解压好的文件移到比较好的位置: eg. D:\mingw64
, 并将 D:\mingw64\bin
加入到 环境变量
中,打开终端输入 g++ --version
验证:

VS Code 安装 C/C++ 插件,并配置 c_cpp_properties.json
:
主要是添加
"compilerPath": "D:/mingw64/bin/g++.exe"
{
"configurations": [
{
"name": "Win32",
"compilerPath": "D:/mingw64/bin/g++.exe",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}
参考链接:
- Visual Studio Code 如何编写运行 C、C++ 程序? - 谭九鼎的回答 - 知乎
- https://code.visualstudio.com/docs/cpp/config-mingw
网友评论