Ask Your Question
0

ROS including headers

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

ruben.gbarriada gravatar image

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

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 imageLorenz ( 2012-10-10 00:40:16 -0600 )edit

Can you please provide the error messages you get?

Lorenz gravatar imageLorenz ( 2012-10-10 02:45:20 -0600 )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 imageLorenz ( 2012-10-10 03:56:55 -0600 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2012-10-10 04:04:07 -0600

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

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: 2012-10-10 00:24:49 -0600

Seen: 567 times

Last updated: Oct 10 '12