{
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"command": "g++",
"args": [
"-g",
"-Wall",
"-std=c++11",
"-lm",
"${file}",
"-o"
],
"windows": {
"args": [
"${fileDirname}/${fileBasenameNoExtension}.exe"
]
},
"linux": {
"args": [
"${fileDirname}/${fileBasenameNoExtension}.o"
]
},
"osx": {
"args": [
"${fileDirname}/${fileBasenameNoExtension}.o"
]
},
"presentation": {
"reveal": "always",
"echo": false,
"focus": true
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": "absolute",
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Run",
"type": "shell",
"dependsOn": "Build",
"command": "${fileDirname}/${fileBasenameNoExtension}.o",
"windows": {
"command": "${fileDirname}/${fileBasenameNoExtension}.exe"
},
"args": [],
"presentation": {
"reveal": "always",
"focus": true
},
"problemMatcher": [],
"group": {
"kind": "test",
"isDefault": true
}
}
]
}
Vscode C/C++tasks.json
最新推荐文章于 2025-10-23 17:22:45 发布
本文介绍了一个用于 C++ 项目的编译与运行任务配置方案,包括使用 g++ 编译器进行编译,支持多种操作系统环境,并详细解释了如何通过正则表达式匹配编译错误。
3万+

被折叠的 条评论
为什么被折叠?



