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

C++11 compatibility

asked 2013-07-19 07:42:34 -0500

Hansg91 gravatar image

updated 2014-01-28 17:17:19 -0500

ngrennan gravatar image


Is it possible yet to have a package in ROS compiled with c++ 11 support? Or does ROS need to be compiled from source with c++ 11? If so, is this possible?

Thanks in advance.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2013-07-20 01:30:42 -0500

130s gravatar image

updated 2013-09-11 06:32:03 -0500

I might be wrong but would like to give it a try.

Given that ROS supports only C++03 up to Hydro so far and as far as I haven't seen discussion about C++0x support, I think your question falls into general C++ discussion. And because of possible API incompatibility, mixing compiled C++03 and C++0x may or may not work.

UPDATE) This newer thread might answer more to your interest.

edit flag offensive delete link more


I had seen that post too, but since it was from 2011 I had hoped it would be possible by now. I added the c++0x flag and the c++11 flag but in both cases I get an error from some ros messages. Guessing it is not possible yet, but it has been out for a while now so making that step seems logical.

Hansg91 gravatar image Hansg91  ( 2013-07-20 03:14:09 -0500 )edit

I would suggest then to start discussion in [ros-users]( (I'm not sure which component is the right place).

130s gravatar image 130s  ( 2013-07-22 19:18:57 -0500 )edit

Thank you for the update, I am indeed using OSX. Too bad c++11 support doesn't work proper on OSX then.

Hansg91 gravatar image Hansg91  ( 2013-09-13 02:01:08 -0500 )edit

answered 2016-04-08 06:33:08 -0500

Nowadays it is possible.

Just add this to your CMakeLists.txt file

if(CMAKE_COMPILER_IS_GNUCXX) add_definitions(-std=gnu++0x) endif()

Be careful with the boost::shared_ptr pointers that are intensively used in ROS and but they are not compatible with std::shared_ptr

edit flag offensive delete link more

Question Tools


Asked: 2013-07-19 07:42:34 -0500

Seen: 3,170 times

Last updated: Apr 08 '16