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

You don't do anything in the CMakeLists.txt of your pubsub package which would add the include directory for your foo_msgs package to your include directory path.

Normally, when you depend on one package from another, you should use catkin to find it, the same you do for other ROS packages:

find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs foo_msgs)

This automatically adds the include paths for roscpp, rospy, std_msgs and foo_msgs to the ${catkin_INCLUDE_DIRS} variable.

You then add these include directories to your include search path using:

include_directories(${catkin_INCLUDE_DIRS})

Or

include_directories(include ${catkin_INCLUDE_DIRS}) # if your package contains an include directory that you are using