编写launch.json文件
如果需要修改需要调试的二进制文件,可以修改
"program": "${workspaceFolder}/build/testall"
testall是指需要调试的二进制文件。
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/testall",
"args": [],
"stopAtEntry": false,
"cwd": ".",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "make build"
}
]
}
编写tasks.json文件
{
"version":"2.0.0",
"tasks":[
{
"label": "make build",
"type": "shell",
"command":"cmake .. & make",
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "clean",
"type": "shell",
"command": "make clean"
}
]
}