参考链接:https://blog.youkuaiyun.com/u010677365/article/details/80703984
照着以上链接生成c_cpp_properties.json
、launch.json、tasks.json
遇到问题:cannot open source file "ros/ros.h" ,在直接c_cpp_properties.json中的includepath中设置,却什么文件就include什么文件路径
。
以下是我的c_cpp_properties.json文件中添加的includepath。
注:json文件不支持注释,不能//加注释,我加为了方便看懂。
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/include",
"/opt/ros/kinetic/include", //缺少ros/ros.h文件加这个
"/home/llx/ORB-SLAM2/include",
"/home/llx/Pangolin/build/src/include",
"/home/llx/Pangolin/include", //缺少pangolin/pangplin.h加这个
"/home/llx/ORB-SLAM2",
"/usr/include/eigen3" //缺少eigen/eigen.h文件加这个
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
launch.json只修改“program”、"args".
"program": "/home/llx/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/Mono",
"args": [
"/home/llx/catkin_ws/src/ORB_SLAM2/Vocabulary/ORBvoc.txt",
"/home/llx/catkin_ws/src/ORB_SLAM2/Examples/Monocular/TUM1.yaml"
],