CMake Error (generate_messages) Example 6.8

after executing catkin_make i get

generate_messages at CmakeLists looks like that

Tried to remove build and devel, catkin_make --only-pkg-with-deps, copying directly from example 6.8, nothing helped

Hi @belkloilya ,

Welcome to this Community!

It seems that you have not exactly followed the instructions. I could infer this looking at your CMakeLists.txt file.

So what you have to do is:

  1. Include message_generation under find_package in your CMakeLists.txt file, like this:
find_package(catkin REQUIRED COMPONENTS
  message_generation # this package is important for custom messages
  1. Add the service file name to add_service_files() in CMakeLists.txt
  1. Your generate_messages() looks correct. You do not have to modify this.
  std_msgs  # Or other packages containing msgs
  1. Finally, you must add these three (3) lines into your package.xml file:
    (Make sure you have the same three lines for rospy and std_msgs)



Once you have all these, you should be able to re-build the package without any problems.

Let me know if this solves your problem.


PS: If the custom message is not properly built, then you cannot run any script with rosrun that uses the custom message. It will produce error.

1 Like

Thank you so much! It finally works!