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

Revision history [back]

click to hide/show revision 1
initial version

I'm sorry you're finding this frustrating, I can sympathize. Unfortunately to resolve this, you need to have a target dependency on the message generation. We cannot do this automatically because catkin does not override the add_executable macro in CMake. Though we've tried to mention it everywhere we think it might be run into, if it is lacking from some piece of the documentation, please feel free to update it yourself or at least point someone to the deficient docs.

This extra step for depending on message generation targets is described in the ROS Tutorials:

http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29#roscpp_tutorials.2BAC8-Tutorials.2BAC8-WritingPublisherSubscriber.Building_your_nodes-1

It is also mentioned in the sort of cookbook for catkin CMakeLists.txt:

http://wiki.ros.org/catkin/CMakeLists.txt#Important_Prerequisites.2BAC8-Constraints

And in the official genmsg documentation (genmsg is the package which generates messages):

http://docs.ros.org/api/genmsg/html/usermacros.html

There is also a answer on this site, which I think you've found:

http://answers.ros.org/question/111136/fatal-error-file-massageh-not-found/?comment=192767#comment-192767

Hope that helps!

EDIT: I just noticed that you are actually using the right target dependency options here, let me look at it again. Sorry for the noise below.


I'm sorry you're finding this frustrating, I can sympathize. Unfortunately to resolve this, you need to have a target dependency on the message generation. We cannot do this automatically because catkin does not override the add_executable macro in CMake. Though we've tried to mention it everywhere we think it might be run into, if it is lacking from some piece of the documentation, please feel free to update it yourself or at least point someone to the deficient docs.

This extra step for depending on message generation targets is described in the ROS Tutorials:

http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29#roscpp_tutorials.2BAC8-Tutorials.2BAC8-WritingPublisherSubscriber.Building_your_nodes-1

It is also mentioned in the sort of cookbook for catkin CMakeLists.txt:

http://wiki.ros.org/catkin/CMakeLists.txt#Important_Prerequisites.2BAC8-Constraints

And in the official genmsg documentation (genmsg is the package which generates messages):

http://docs.ros.org/api/genmsg/html/usermacros.html

There is also a answer on this site, which I think you've found:

http://answers.ros.org/question/111136/fatal-error-file-massageh-not-found/?comment=192767#comment-192767

Hope that helps!

EDIT2: This line in your CMake code can be simplified:

add_dependencies(${p} ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_generate_messages_cpp)

These are the only two things you would ever need to do, catkin_EXPORTED_TARGETS is never empty, which is important because add_dependencies will fail if you give it variables which do not exist.

I can't see why your code is not compiling on the first try from what you have shown us, is it where you could share these two packages with us, maybe even in private?


EDIT: I just noticed that you are actually using the right target dependency options here, let me look at it again. Sorry for the noise below.


I'm sorry you're finding this frustrating, I can sympathize. Unfortunately to resolve this, you need to have a target dependency on the message generation. We cannot do this automatically because catkin does not override the add_executable macro in CMake. Though we've tried to mention it everywhere we think it might be run into, if it is lacking from some piece of the documentation, please feel free to update it yourself or at least point someone to the deficient docs.

This extra step for depending on message generation targets is described in the ROS Tutorials:

http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29#roscpp_tutorials.2BAC8-Tutorials.2BAC8-WritingPublisherSubscriber.Building_your_nodes-1

It is also mentioned in the sort of cookbook for catkin CMakeLists.txt:

http://wiki.ros.org/catkin/CMakeLists.txt#Important_Prerequisites.2BAC8-Constraints

And in the official genmsg documentation (genmsg is the package which generates messages):

http://docs.ros.org/api/genmsg/html/usermacros.html

There is also a answer on this site, which I think you've found:

http://answers.ros.org/question/111136/fatal-error-file-massageh-not-found/?comment=192767#comment-192767

Hope that helps!