怎样让vscode一键编译运行c++并且还能调试
展开全部
不知道题主的vscode用的爽不,我正好搜到你的,然后我解决了。一键直接编译调试,断点
vscode配置C/C++的编译调试环境
安装debug插件,然后配置如下,详情参考上面链接
//launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "gdb",
"request": "launch",
"target": "${file}.o",
"cwd": "${workspaceRoot}",
"preLaunchTask": "gcc"
}
]
}
//tasks.json
{
"version": "0.1.0",
"command": "gcc",
"args": ["-g", "${file}", "-o", "${file}.o"],
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
vscode配置C/C++的编译调试环境
安装debug插件,然后配置如下,详情参考上面链接
//launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "gdb",
"request": "launch",
"target": "${file}.o",
"cwd": "${workspaceRoot}",
"preLaunchTask": "gcc"
}
]
}
//tasks.json
{
"version": "0.1.0",
"command": "gcc",
"args": ["-g", "${file}", "-o", "${file}.o"],
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询