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

ROS including headers

asked 2012-10-10 00:24:49 -0500

ruben.gbarriada gravatar image

updated 2012-10-10 03:55:19 -0500

Lorenz gravatar image

Hi all,

How can I make that ROS look for headers files in /usr/include directory when compiling?

I want to use some headers present in that folder, but when I include them in my code and make it, the compiler cannot find the header files. Concretelly, I want to use gtkmm.h, in /usr/include/gtkmm-2.4/gtkmm.h. If I include the file like:

#include <gtkmm-2.4/gtkmm.h>

it works, but it start to ask for another headers. I want it to search in /usr/include for all dependencies.

This is exactly the error I am getting when making the package:

cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=`rospack find rosbuild`/rostoolchain.cmake  ..
[rosbuild] Building package prglade
[rosbuild] Including /opt/ros/fuerte/share/roslisp/rosbuild/roslisp.cmake
[rosbuild] Including /opt/ros/fuerte/share/rospy/rosbuild/rospy.cmake
[rosbuild] Including /opt/ros/fuerte/share/roscpp/rosbuild/roscpp.cmake
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_TOOLCHAIN_FILE


-- Build files have been written to: /home/ruben/ROS_workspace/prglade/build
cd build && make 
make[1]: se ingresa al directorio «/home/ruben/ROS_workspace/prglade/build»
make[2]: se ingresa al directorio «/home/ruben/ROS_workspace/prglade/build»
make[3]: se ingresa al directorio «/home/ruben/ROS_workspace/prglade/build»
make[3]: se sale del directorio «/home/ruben/ROS_workspace/prglade/build»
[  0%] Built target rospack_genmsg_libexe
make[3]: se ingresa al directorio «/home/ruben/ROS_workspace/prglade/build»
make[3]: se sale del directorio «/home/ruben/ROS_workspace/prglade/build»
[  0%] Built target rosbuild_precompile
make[3]: se ingresa al directorio «/home/ruben/ROS_workspace/prglade/build»
make[3]: se sale del directorio «/home/ruben/ROS_workspace/prglade/build»
make[3]: se ingresa al directorio «/home/ruben/ROS_workspace/prglade/build»
[ 50%] Building CXX object CMakeFiles/main_node.dir/src/main_node.o
In file included from /home/ruben/ROS_workspace/prglade/src/main_node.cpp:5:0:
/home/ruben/ROS_workspace/prglade/src/viewer.h:5:19: error fatal: gtkmm.h: No existe el archivo o el directorio
compilación terminada.
make[3]: *** [CMakeFiles/main_node.dir/src/main_node.o] Error 1
make[3]: se sale del directorio «/home/ruben/ROS_workspace/prglade/build»
make[2]: *** [CMakeFiles/main_node.dir/all] Error 2
make[2]: se sale del directorio «/home/ruben/ROS_workspace/prglade/build»
make[1]: *** [all] Error 2
make[1]: se sale del directorio «/home/ruben/ROS_workspace/prglade/build»
make: *** [all] Error 2

Thanks in advance

edit retag flag offensive close merge delete

Comments

2

The ROS build process does not exclude the header files in /usr/include. They should be found, most nodes rely on that. Can you please edit your answer and add the exact error messages you get? See http://ros.org/wiki/Support

Lorenz gravatar image Lorenz  ( 2012-10-10 00:40:16 -0500 )edit

Can you please provide the error messages you get?

Lorenz gravatar image Lorenz  ( 2012-10-10 02:45:20 -0500 )edit

Please do not create answers just for discussion or updates. Instead, please always edit your original post in such cases. This is not a forum. I updated your original question with your 'answer' and deleted it.

Lorenz gravatar image Lorenz  ( 2012-10-10 03:56:55 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2012-10-10 04:04:07 -0500

Lorenz gravatar image

To me it seems like the include in viewer.h is not

#include <gtkmm-2.4/gtkmm.h>

but

#include <gtkmm.h>

So what you actually need is to add /usr/include/gtkmm-2.4 to your include path.

To include libraries in CMake, you normally either use cmake's built-in find macros or pkgconfig. Have a look here to find out how to correctly include gtkmm in CMake.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-10-10 00:24:49 -0500

Seen: 716 times

Last updated: Oct 10 '12