linux下配置vscode中的ros的c++调试

第一步

linux下配置vscode中的ros的c++调试_第1张图片
在这里插入图片描述

这块是launch.json

{
    "version": "0.2.0",
    "configurations": [
        
        {
            "name": "g++ - 生成和调试活动文件",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/devel/lib/beginner_tutorials/talker",//要调试的可执行文件,你调试那个文件记得把talker改为相应的cpp文件名字,beginner_tutorials为功能包
            "args": [],
            "stopAtEntry": true,//设为true则调试运行时会先停在程序开始
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "builtCpp",//要与tasks.json中label的值保持一致
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

这一块是settings.json

{
    "python.autoComplete.extraPaths": [
        "/home/edu/catkin_ws/devel/lib/python3/dist-packages",
        "/opt/ros/noetic/lib/python3/dist-packages"
    ],
    "python.analysis.extraPaths": [
        "/home/edu/catkin_ws/devel/lib/python3/dist-packages",
        "/opt/ros/noetic/lib/python3/dist-packages"
    ],
    "cmake.sourceDirectory": "/home/edu/catkin_ws/src/beginner_tutorials",
    "files.associations": {
        "*.urdf": "xml",
        "*.urdf.xacro": "xml",
        "cstdlib": "cpp"
    }
}

这里是task.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "builtCpp",
            "command": "catkin_make -DCMAKE_BUILD_TYPE=Debug",
            "args": [],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build"
        },
       
    ]
}

linux下配置vscode中的ros的c++调试_第2张图片

你可能感兴趣的:(linux,vscode,c++,ros)