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

A myriad of libboost errors caused in tf or ros::param::get due to std::tuple declaration? Fix -std=c++11??

asked 2019-04-04 03:20:52 -0500

Juan gravatar image

updated 2019-04-04 04:10:31 -0500

Ubuntu 16.04 ROS Kinetic DPKG states libboost1.58 for all libraries, catkin_make states libboost 1.50

Very recently I decided to clear /build and /devel and rebuild my workspace. A large list of boost errors for almost every package came out.

I see these errors start in multiple ros binaries:

ros::param::get <-  tf/listener.h <- tf.h <- boost/tuple.hpp 
tf/transform_broadcaster.h <- tf.h <- boost/signals2.hpp <- c++/5/tuple

Some of the error descriptions are included below:

from /usr/include/c++/5/tuple:35:0,
             from /usr/local/include/boost/signals2/detail/variadic_slot_invoker.hpp ... error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or enter code here-std=gnu++11 compiler options.

from /usr/local/include/boost/signals2/variadic_signal.hpp:21:0,
                 from /usr/local/include/boost/signals2/signal.hpp:38 ... /usr/local/include/boost/signals2/detail/variadic_slot_invoker.hpp:68:41: error: ‘std::tuple’ has not been declared
           R operator()(Func &func, std::tuple<Args...> args) const


 /usr/local/include/boost/signals2/detail/variadic_slot_invoker.hpp: In member function ‘R boost::signals2::detail::call_with_tuple_args<R>::m_invoke(T*, Func&, boost::signals2::detail::unsigned_meta_array<indices ...>, int) const’:
    /usr/local/include/boost/signals2/detail/variadic_slot_invoker.hpp:78:23: error: ‘get’ is not a member of ‘std’
               return func(std::get<indices>(args)...);


from /usr/local/include/boost/signals2/detail/variadic_slot_invoker.hpp:22...
error: ‘std::tuple’ has not been declared
           R operator()(Func &func, std::tuple<Args...> args) const

I believe the error might be related to the condition described below:

The C++ standard doesn't allow a user to add forward declarations or definitions into namespace std. Adding declarations or definitions to namespace std or to a namespace within namespace std now results in undefined behavior.

At some time in the future, Microsoft will move the location where some STL types are defined. When this happens, it will break existing code that adds forward declarations to namespace std. A new warning, C4643, helps identify such source issues. The warning is enabled in /default mode and is off by default. It will impact programs that are compiled with /Wall or /WX

People have suggested adding the following compile options to a package's CMakeLists.txt:



set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")

This solution seems only partial. Some packages display other libboost errors after this. Even if it were to work, it seems undesirable, as I would have to add this flag across hundreds of packages.

Are others experiencing these problems? Did this result from changes to C? A new standard? Any good solutions?

edit retag flag offensive close merge delete


The propper way to enable C++11 with CMake is set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) . Any other method will lead to problems at some point.

VictorLamoine gravatar image VictorLamoine  ( 2019-04-04 03:33:49 -0500 )edit

Are you aware of any conflicts between ros/boost/tuple or new C standards?

Juan gravatar image Juan  ( 2019-04-04 04:10:01 -0500 )edit

Should I try to set my to version 1.50?

i.e. From -> / to /

If I do I get the following warning:

/usr/bin/ld: warning:, needed by /opt/ros/kinetic/lib/, may conflict with

But it seems to resolve all the boost errors...

Juan gravatar image Juan  ( 2019-04-04 04:43:21 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-04-04 05:08:30 -0500

gvdhoorn gravatar image

updated 2019-04-04 05:11:17 -0500

I see this in the output you post:


this implies that you have a "custom" install of Boost (probably built from sources) on that system.

All binary ROS packages will have been built using the system provided (ie: Ubuntu) version of Boost. Mixing-and-matching Boost versions will lead to (sometimes very) hard to diagnose issues, and is not really supported.

And yes: every package using C++11 features will have to enable them explicitly (at least on Ubuntu Xenial, which ships GCC 4.8.1 by default). Many ROS packages for Kinetic already.

I'd suggest to first clarify the situation with Boost on your system, then diagnose further.

edit flag offensive delete link more


My apologies. I had installed an older version of boost in my system (1.50.0). This installation created conflicts with the current 1.58.0 boost version for Ubuntu 16.04. Once removed everything built fine.

Juan gravatar image Juan  ( 2019-04-04 22:50:00 -0500 )edit

Question Tools

1 follower


Asked: 2019-04-04 03:20:52 -0500

Seen: 331 times

Last updated: Apr 04 '19