具体参照https://blog.csdn.net/qq_16775293/article/details/80597763
头文件包含进目标包的头文件,例如:
#include "msgfile/test_msg.h"
CMakeList.txt 进行两处修改
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
msgfile
)
include_directories(
include ${catkin_INCLUDE_DIRS}
)
和package.xml 新增依赖文件
<build_depend>msgfile</build_depend>
<build_export_depend>msgfile</build_export_depend>
<exec_depend>msgfile</exec_depend>
之后可以构建和运行了