Ask Your Question

{PKG_NAME}_generate_messages_cpp vs {PKG_NAME}_gencpp

asked 2013-04-17 18:38:54 -0600

dejanpan gravatar image

Hi there, using catkin in groovy I have seen two ways to specify dependencies to build msgs and srvs:

add_dependencies(my_bin {PKG_NAME}_generate_messages_cpp)


add_dependencies(my_bin {PKG_NAME}_gencpp)

Which one is correct? None of them though seem to build services that my_bin depends on.


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-04-18 09:28:30 -0600

William gravatar image

updated 2015-04-15 13:37:13 -0600

Both of those lines are correct for now, but the latter will be deprecated.

The _gencpp is the old style, the _generate_messages_cpp target is the new name (more descriptive).

These targets are created by the generate_messages(DEPENDENCIES ...) CMake macro call. Calling add_dependencies(my_bin ${PKG_NAME}_generate_messages_cpp) just tells CMake that the ${PKG_NAME}_generate_messages_cpp target should be built before the my_bin target. It does not instruct CMake to generate your messages. So, if you are expecting this line to cause your services to be built, then that's incorrect.

See the ROS tutorials about how to get services generated:

edit flag offensive delete link more


William, the services that needed to be build are in the pkg PKG_NAME I depend on with the above code. And if I understand you correctly then it should be all fine.

dejanpan gravatar imagedejanpan ( 2013-04-19 11:12:08 -0600 )edit

That should ensure that those services are generated before your code is built.

William gravatar imageWilliam ( 2013-04-19 11:13:28 -0600 )edit

As an extra bit of detail for the answer by @William, see by Dirk Thomas.

gvdhoorn gravatar imagegvdhoorn ( 2013-12-03 20:11:13 -0600 )edit

What could be the problem if the only one which works to me is _gencpp? With _generate_message_cpp it does not generate message and action files which I have included correctly...

alextoind gravatar imagealextoind ( 2015-04-15 10:40:35 -0600 )edit

I think my post has a typo, it should be _generate_messages_cpp.

William gravatar imageWilliam ( 2015-04-15 13:36:55 -0600 )edit

thanks! It's ok now. (I've copied the wrong one without noticing the typo)

alextoind gravatar imagealextoind ( 2015-04-15 16:01:44 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2013-04-17 18:38:54 -0600

Seen: 1,444 times

Last updated: Apr 15 '15