ROS编译出现generate_messages() must be called after add_message_files()错误

新人小白,刚刚开始学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 等所有通信服务之后,不然就会出现上面的错误。

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值