新人小白,刚刚开始学ROS,编译出现这个错误,搞了好久也没找到这个问题,后来偶然发现了问题所在。
CMake Error at /opt/ros/kinetic/share/genmsg/cmake/genmsg-extras.cmake:98 (message):
generate_messages() must be called after add_message_files()
Call Stack (most recent call first):
/opt/ros/kinetic/share/actionlib_msgs/cmake/actionlib_msgs-extras.cmake:70 (add_message_files)
learning_communication/CMakeLists.txt:85 (add_action_files)
-- Configuring incomplete, errors occurred!
See also "/home/fish/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/fish/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:766: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
add_message_files(FILES Person.msg)
add_service_files(FILES AddTwoInts.srv)
add_action_files(DIRECTORY action FILES DoDishes.action)
generate_messages(DEPENDENCIES std_msgs actionlib_msgs)
在CmakeLists.txt文件中,generate_messages的函数必须在topic action 等所有通信服务之后,不然就会出现上面的错误。