ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

depends on message does not work for my node

asked 2014-05-25 20:27:05 -0600

Jonathan Ruiz gravatar image


I have some nodes that uses custom messages that I have in my workspace. In the package.xml I have declared it as depends (build and run), but if I clean the workspace when I use catkin_make to build everything it crash.

The crash is because the compiler try to build the node before generating the message and cannot find header files for the messages.

I think that I forgot something, but I cannot find a solution in the web.

Thanks you very much.

PD: I am using hydro.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-05-26 00:59:11 -0600

fergs gravatar image

The package.xml isn't really used much during the build, what you are looking for is to add dependencies in your CMakeLists.txt. For instance, if you have a target called foo, and a package named my_msgs, you would "add_dependencies":

add_executable(foo src/foo.cpp)
# other link, etc commands
add_dependencies(foo my_msgs_generate_messages_cpp)

This will then cause CMake to build your messages before your node.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-05-25 20:27:05 -0600

Seen: 125 times

Last updated: May 26 '14