sns_ik icon indicating copy to clipboard operation
sns_ik copied to clipboard

C++ 0x or 11 flags required when linking against sns_ikl

Open rethink-imcmahon opened this issue 9 years ago • 0 comments

Without something like this in the CMakeLists.txt file of a package depending on this library:

# Verify c++11 / c++0x is valid for this compiler
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
    set(CMAKE_CXX_FLAGS "-std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
    set(CMAKE_CXX_FLAGS "-std=c++0x")
else()
    message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++0X or C++11 support. Please choose different C++ compiler.")
endif()

catkin_make will throw this error:

In file included from /usr/include/c++/4.8/forward_list:35:0,
                 from /data/users/imcmahon/dev/ik_dev/src/sns_ikl/sns_ik_lib/include/sns_ik/sns_ik.hpp:27,
                 from /data/users/imcmahon/dev/ik_dev/src/sns_ikl/sns_ik_examples/src/test_sns_ik.cpp:3:
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
In file included from /data/users/imcmahon/dev/ik_dev/src/sns_ikl/sns_ik_examples/src/test_sns_ik.cpp:3:0:
/data/users/imcmahon/dev/ik_dev/src/sns_ikl/sns_ik_lib/include/sns_ik/sns_ik.hpp:196:12: error: forward_list was not declared in this scope
     vector<forward_list<int>> satList;
            ^

This either needs a code rework or additional documentation if we are targeting ROS Indigo or Jade: http://www.ros.org/reps/rep-0003.html

Jade Turtle (May 2015 - May 2017)
...
C++03 (C++11 features are not used, but code should compile when -std=c++11 is used)

If we are targeting ROS Kinetic, then it might be fine as is.

rethink-imcmahon avatar Feb 16 '16 15:02 rethink-imcmahon