Ask Your Question
0

Unable to find header files when compiing

asked 2011-07-13 02:21:00 -0500

qdocehf gravatar image

updated 2011-07-13 06:17:28 -0500

I am writing a node, and I am trying to use the ROS and tf tutorials to help me. When I try to compile the .cpp file, the files that I have included, such as

#include <ros/ros.h>
#include <ros/package.h>

cannot be found. Am I supposed to include these under different names?

This is my CMakeLists.txt:

cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#uncomment if you have defined messages
#rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()

#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_add_boost_directories()
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})
rosbuild_add_executable(SkeletonTracker src/SkeletonTracker.cpp)

This is my manifest.xml:

<package>
  <description brief="skeletonTracker">

     skeletonTracker

  </description>
  <author>robot</author>
  <license>BSD</license>
  <review status="unreviewed" notes=""/>
  <url>http://ros.org/wiki/skeletonTracker</url>
  <depend package="std_msgs"/>
  <depend package="rospy"/>
  <depend package="roscpp"/>

</package>

If I try to use rosmake to build the package, this is output:

robot@neutronstar:~/SkeletonTracking/skeletonTracker$ rosmake
[ rosmake ] No package specified.  Building ['skeletonTracker']                 
[ rosmake ] Packages requested are: ['skeletonTracker']                         
[ rosmake ] Logging to directory/home/robot/.ros/rosmake/rosmake_output-20110713-134607
[ rosmake ] Expanded args ['skeletonTracker'] to:
['skeletonTracker']           
[ rosmake ] Checking rosdeps compliance for packages skeletonTracker.  This may take a few seconds.
[ rosmake ] rosdep check passed all system dependencies in packages             
[rosmake-0] Starting >>> roslib [ make ]                                        
[rosmake-0] Finished <<< roslib ROS_NOBUILD in package roslib                   
[rosmake-1] Starting >>> rosgraph_msgs [ make ]                                 
[rosmake-1] Finished <<< rosgraph_msgs ROS_NOBUILD in package rosgraph_msgs     
[rosmake-2] Starting >>> rosbuild [ make ]                                      
[rosmake-2] Finished <<< rosbuild ROS_NOBUILD in package rosbuild
 No Makefile in package rosbuild
[rosmake-3] Starting >>> cpp_common [ make ]                                    
[rosmake-0] Starting >>> std_msgs [ make ]                                      
[rosmake-1] Starting >>> roslang [ make ]                                       
[rosmake-3] Finished <<< cpp_common ROS_NOBUILD in package cpp_common           
[rosmake-0] Finished <<< std_msgs ROS_NOBUILD in package std_msgs               
[rosmake-1] Finished <<< roslang ROS_NOBUILD in package roslang
 No Makefile in package roslang
[rosmake-2] Starting >>> xmlrpcpp [ make ]                                      
[rosmake-0] Starting >>> roscpp_traits [ make ]                                 
[rosmake-1] Starting >>> rostime [ make ]                                       
[rosmake-2] Finished <<< xmlrpcpp ROS_NOBUILD in package xmlrpcpp               
[rosmake-3] Starting >>> rospy [ make ]                                         
[rosmake-1] Finished <<< rostime ROS_NOBUILD in package rostime                 
[rosmake-3] Finished <<< rospy ROS_NOBUILD in package rospy                     
[rosmake-0] Finished <<< roscpp_traits ROS_NOBUILD in package roscpp_traits     
[rosmake-1] Starting >>> roscpp_serialization [ make ]                          
[rosmake-3] Starting >>> rosconsole [ make ]                                    
[rosmake-3] Finished <<< rosconsole ROS_NOBUILD in package rosconsole           
[rosmake-1] Finished <<< roscpp_serialization ROS_NOBUILD in package roscpp_serialization
[rosmake-1] Starting >>> roscpp [ make ]                                        
[rosmake-1] Finished <<< roscpp ROS_NOBUILD in package roscpp                   
[rosmake-1] Starting >>> skeletonTracker [ make ]                               
[ rosmake ] Last 40 lineseletonTracker: 2.8 sec ]    [ 1 Active 14/15 Complete ]
{-------------------------------------------------------------------------------
  make[3]: Leaving directory `/home/robot/SkeletonTracking/skeletonTracker/build'
  [  0%] Built target rospack_genmsg_libexe
  make[3]: Entering directory `/home/robot/SkeletonTracking/skeletonTracker/build'
  make[3]: Leaving directory `/home/robot/SkeletonTracking/skeletonTracker ...
(more)
edit retag flag offensive close merge delete

Comments

Can you also add the settings of ROS_ROOT and ROS_PACKAGE_PATH + the exact error output.
dornhege gravatar imagedornhege ( 2011-07-13 05:42:47 -0500 )edit
How do I find the settings of ROS_ROOT and ROS_PACKAGE_PATH?
qdocehf gravatar imageqdocehf ( 2011-07-13 05:49:49 -0500 )edit
Currently, the only dependencies I still need are for tf/frames.hpp and Xn header files.
qdocehf gravatar imageqdocehf ( 2011-07-13 06:16:18 -0500 )edit
See my updated answer.
arebgun gravatar imagearebgun ( 2011-07-13 06:32:29 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
3

answered 2011-07-13 05:58:51 -0500

arebgun gravatar image

updated 2011-07-13 06:42:43 -0500

Your description and error output say two completely different things. Judging from the output transform_broadcaster.h can't be found, for that you need to depend on tf package. When you add that dependency to your manifest it should compile, provided there are no other errors.

<depend package="tf"/>

tf/frames.hpp include file does not exist, you probably meant kdl/frames.hpp.

<depend package="kdl"/>

To use Xn* headers you need to depend on nite and openni packages.

<depend package="nite"/>
<depend package="openni"/>
edit flag offensive delete link more

Comments

Sorry, the ros headers had not been working earlier, so I did not check when I uploaded the errors.
qdocehf gravatar imageqdocehf ( 2011-07-13 06:04:46 -0500 )edit
Could you give me exactly what I need to add to the manifest.xml file for the Xn headers(<depend package="_____">)? I do not know where to find it, and it does not fit the pattern of the others.
qdocehf gravatar imageqdocehf ( 2011-07-13 06:37:24 -0500 )edit
@qdocehf... he did include the lines. OpenNI.
Asomerville gravatar imageAsomerville ( 2011-07-14 09:07:13 -0500 )edit
1
He edited it after I made the comment.
qdocehf gravatar imageqdocehf ( 2011-07-15 01:34:21 -0500 )edit
1

answered 2011-07-13 02:28:54 -0500

I believe ros/ros.h is part of the roscpp package.

Are you using the ROS Build System? You need to include roscpp as a dependency in the manifest.xml of the package you are building:

<depend package="roscpp"/>
edit flag offensive delete link more

Comments

Yes, this was already in my manifest.xml
qdocehf gravatar imageqdocehf ( 2011-07-13 02:31:25 -0500 )edit
Can you share your CMakeLists.txt and manifest.xml? Also, does "roscd roscpp" take you to the correct folder?
Ivan Dryanovski gravatar imageIvan Dryanovski ( 2011-07-13 02:36:50 -0500 )edit
1

answered 2011-07-13 06:00:04 -0500

makokal gravatar image

From your output, it looks like you need to add a tf dependency in the manifest.xml file, i;e

<depend package="tf"/>

let us know if there are more errors

edit flag offensive delete link more

Comments

tf/frames.hpp and the Xn header files (XnOpenNI.h; XnCodeIDs.h; XnCppWrapper.h) still cannot be found. Which dependencies do I need for those?
qdocehf gravatar imageqdocehf ( 2011-07-13 06:08:23 -0500 )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

Stats

Asked: 2011-07-13 02:21:00 -0500

Seen: 6,215 times

Last updated: Jul 13 '11