VScode中调试ROS程序

发布时间 2023-12-15 16:51:38作者: 依旧是缘来的你

1.代码智能提示

编译输出信息文件,在命令行中执行:

catkin_make -DCMAKE_EXPORT_COMPILE_COMMANDS=Yes

这个命令会输出一个compile_commands.json文件在ROS工作空间的build文件夹下面

添加以下信息文件到c_cpp_properties.json文件中的相应位置:

"name": "ROS",’ "intelliSenseMode": "gcc-x64", "compilerPath": "/usr/bin/g++", "cStandard": "c11", "cppStandard": "c++11", "compileCommands": "${workspaceFolder}/build/compile_commands.json"`

其中部分也可以替换为:
"compilerPath": "/usr/bin/gcc", "cStandard": "c11", "cppStandard": "c++17", "intelliSenseMode": "clang-x64",