Ask Your Question
1

Using Boost with roscpp (Catkin errors)

asked 2015-04-09 15:00:07 -0500

Jordan9 gravatar image

updated 2015-04-10 13:52:00 -0500

I'm trying to use some boost functions in my C++ ROS code, but running into some frustrating issues with catkin.

In my CMakeLists.txt file, I have the following:

cmake_minimum_required(VERSION 2.8.3)

project(project_name)

find_package(
  catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  Boost
)
include_directories(
  include ${catkin_INCLUDE_DIRS} ${roscpp_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
)

add_executable(exec_name src/exec_name.cpp)

target_link_libraries(exec_name ${catkin_LIBRARIES})

And I have installed libboost-all-dev on my Ubuntu 14.04 machine with apt-get. When I try to compile my project, however, I get the following error:

CMake Error at /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:75 (find_package): Could not find a package configuration file provided by "Boost" with any of the following names:

BoostConfig.cmake
boost-config.cmake

Add the installation prefix of "Boost" to CMAKE_PREFIX_PATH or set
"Boost_DIR" to a directory containing one of the above files. If "Boost"
provides a separate development package or SDK, be sure it has been
installed.

I have searched all the files on the machine and cannot find anywhere a file named "BoostConfig.cmake" or "boost-config.cmake", are they something that should be included when I installed Boost through apt-get? If anyone could help me figure out why CMake can't find Boost, it would be hugely appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-04-10 06:14:04 -0500

timm gravatar image

Can you try to search for Boost in a separate find_package() call?

According to CMake documentation, the syntax is

find_package(<package> [version] [EXACT] [QUIET] [MODULE]
         [REQUIRED] [[COMPONENTS] [components...]]
         [OPTIONAL_COMPONENTS components...]
         [NO_POLICY_SCOPE])

Since Boost is a separate package, and not a component of the catkin package, I believe you should search for it separately:

find_package(
  catkin
  REQUIRED COMPONENTS roscpp rospy std_msgs
)

find_package(
  Boost
  REQUIRED COMPONENTS algorithm
)
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

1 follower

Stats

Asked: 2015-04-09 15:00:07 -0500

Seen: 2,956 times

Last updated: Apr 10 '15