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

Boost Graph classes not recognized

asked 2014-12-01 21:09:59 -0500

lucascoelho gravatar image

I am trying to use Boost Graph on my node, but when I declare an object from Boost Graph I get these errors:

error: ‘adjacency_list’ does not name a type

error: ‘graph_traits’ does not name a type

Then I followed the instructions from this page to properly include the boost during compilation, but the error persists.

I'm sure that Boost Graph is installed and it's working, because I have compiled a similar code using Boost Graph which does not use ROS, so I think that the error stills in the CMakeLists.txt file. Other objects from Boost seem to work fine, like mpl::vector.

Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)

find_package(Boost REQUIRED COMPONENTS system thread graph)

find_package(catkin REQUIRED COMPONENTS

#  LIBRARIES prm_nav
#  CATKIN_DEPENDS geometry_msgs map_server nav_msgs roscpp tf
#  DEPENDS system_lib


add_executable(prm src/prm.cpp)    


So, what is the correct way to use Boost Graph inside ROS? Am I missing something in the CMakeLists.txt file?

Thanks a lot,

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-12-01 21:21:38 -0500

ahendrix gravatar image

I suspect this is a bug in your code and not in your build files, because you're getting an error about missing types/symbols/namespaces. If this was an error in your build files, I would expect either missing header files or linker errors about undefined symbols.

I suspect this is as simple as missing the boost namespace on these keywords, or missing a using namespace ... clause, but without seeing a sample of what you're trying to compile, it's hard to say for sure.

edit flag offensive delete link more


I missed the "using namespace boost;" line, exactly what you said! Thanks a lot!

lucascoelho gravatar image lucascoelho  ( 2014-12-01 21:34:54 -0500 )edit

Question Tools


Asked: 2014-12-01 21:09:59 -0500

Seen: 548 times

Last updated: Dec 01 '14