vscode 远程调试c++
程序员文章站
2022-06-22 20:01:19
...
1、安装远程调试插件:Remote Development
2、自己生成两个配置文件
launch.json 具体配置如下
{
// 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": "clang++ - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
//此处和下面task中的label值相等
"preLaunchTask": "C/C++: clang++ build active file",
"miDebuggerPath": "/usr/bin/gdb"
}
]
}
task.json文件
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.2.0",
"tasks": [
{
"label": "C/C++: clang++ build active file",
"type": "shell",
"command": "g++",
"args": [
"-g",
"-std=c++11",
"-L/data1/out/ffmpeg/lib",
"-I/data1/out/ffmpeg/include",
"-lavcodec",
"-lavdevice",
"-lavfilter",
"-lavformat",
"-lavutil",
"-lpostproc",
"-lswresample",
"-o",
"${fileBasenameNoExtension}",
"${file}"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}