1.在工作空间下,右键新建文件,创建cpp文件。
2.更改CMakeLists.txt文件,demo01_pub.cpp为我的文件名。
ctrl+shift+b编译,界面上端出现搜索框提示,选择:catkin_make:build
替换里边文件。
{
"version": "2.0.0",
"tasks": [
{
"label": "catkin_make:debug",
"type": "shell",
"command": "catkin_make",
"args": [],
"group": {"kind":"build","isDefault":true},
"presentation": {
"reveal": "always"
},
"problemMatcher": "$msCompile"
}
]
}
3.再次编译未报错。