vscode配置c++环境时exe文件的收纳
时间: 2023-07-08 07:35:02 浏览: 283
在 VS Code 中配置 C++ 环境时,可以使用以下两种方式来收纳生成的 exe 文件:
1. 在工作目录下创建一个名为 bin 的文件夹,将生成的 exe 文件放入该文件夹中。
2. 在 VS Code 的配置文件中设置 `"outDir"` 属性,将生成的 exe 文件输出到指定的文件夹中。例如:
```
"tasks": [
{
"type": "shell",
"label": "build",
"command": "g++ -o ${workspaceFolder}/bin/${fileBasenameNoExtension} ${file}",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$gcc",
"options": {
"cwd": "${workspaceFolder}"
},
"presentation": {
"reveal": "silent"
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceFolder}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
],
"cppProperties": {
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:/MinGW/include",
"C:/MinGW/lib/gcc/mingw32/6.3.0/include",
"C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++"
],
"defines": [
"_DEBUG",
"UNICODE"
],
"compilerPath": "C:/MinGW/bin/g++.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64",
"browse": {
"path": [
"${workspaceFolder}"
]
},
"outDir": "${workspaceFolder}/bin"
}
],
"version": 4
}
```
在上面的配置中,`"outDir"` 属性设置为 `${workspaceFolder}/bin`,表示将生成的 exe 文件输出到工作目录下的 bin 文件夹中。
阅读全文