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

From your CMakeLists.txt this appears to be more of a CMake problem than really ROS related, but:

cmake_minimum_required(VERSION 2.8.3)
project(sphero_move)

...

find_package(catkin REQUIRED)

include_directories(${catkin_INCLUDE_DIRS})

find_package(catkin REQUIRED COMPONENTS 
  ...
)

This is your problem: you find_package(..) the catkin package twice. As with other CMake libraries, the second will not necessarily overwrite the first, so it never really does what you want.

Apart from that, you invoke include_directories(..) before your call to find_package(catkin ..) which actually finds the ROS packages you are interested in, and are using. At that point, catkin_INCLUDE_DIRS is empty, leading to no changes to the header search path and ultimately the errors you see.

I'd suggest to merge the two find_package(catkin ..) calls, keep the COMPONENTS and its arguments, and place the include_directories(..) line after find_package(catkin ..) has had a chance to find your dependencies and populate the variable.

Some references: catkin/CMakeLists.txt on the ROS wiki, and catkin 0.6.18 documentation » How to do common tasks » Package format 2 (recommended) in the Catkin docs (Indigo version). For the second link, see the C++ catkin library dependencies and C++ system library dependencies sections.