vscode 1.71 配置 c/c++ 环境
- 安装 vscode
插件安装

- 解压
x86_64-12.2.0-release-win32-sjlj-rt_v10-rev0.7z 或 x86_64-12.2.0-release-win32-seh-rt_v10-rev0.7z
皆可. 本安装解压到 D:\ 盘

- 配置系统路径

- 在相应 vscode 的 c/c++ 项目目录中配置 .vscode 目录 中的 c_cpp_properties.json,launch.json,tasks.json 3个文件.内容分别是:
// c_cpp_properties.json 文件
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "D:\\x86_64-12.2.0-release\\bin\\gcc.exe",
"cStandard": "gnu17",
"cppStandard": "gnu++17",
"intelliSenseMode": "windows-gcc-x64"
}
],
"version": 4
}
// tasks.json 文件
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe 生成活动文件",
"command": "D:\\x86_64-12.2.0-release\\bin\\gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "调试器生成的任务。"
}
],
"version": "2.0.0"
}
// launch.json 文件
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}