vscode c++编译环境 配置文件怎么修改 给一个模版
时间: 2023-06-27 13:01:22 浏览: 64
VSCode 的 C++ 编译环境配置文件是 `tasks.json`,位于 `.vscode` 目录下。以下是一个基本的模板,你可以根据自己的需要进行修改:
```json
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
```
以上模板使用的是 `g++` 编译器,如果你使用的是其他编译器,需要将 `command` 字段中的路径修改为对应编译器的路径。同时,你也可以根据需要修改编译参数以及输出文件名等设置。