G2o 编译是会报以下错误:
error: ‘tuple_size_v’ is not a member of ‘std’; did you mean ‘tuple_size’?
/usr/local/include/g2o/stuff/tuple_tools.h: In function ‘void g2o::tuple_apply_i(F&&, T&, int)’:
/usr/local/include/g2o/stuff/tuple_tools.h:42:46: error: ‘tuple_size_v’ is not a member of ‘std’; did you mean ‘tuple_size’?
42 | f, t, i, std::make_index_sequence<std::tuple_size_v<std::decay_t<T>>>());
| ^~~~~~~~~~~~
| tuple_size
/usr/local/include/g2o/stuff/tuple_tools.h:42:46: error: ‘tuple_size_v’ is not a member of ‘std’; did you mean ‘tuple_size’?
42 | f, t, i, std::make_index_sequence<std::tuple_size_v<std::decay_t<T>>>());
| ^~~~~~~~~~~~
| tuple_size
/usr/local/include/g2o/stuff/tuple_tools.h:42:73: error: template argument 1 is invalid
42 | f, t, i, std::make_index_sequence<std::tuple_size_v<std::decay_t<T>>>());
| ^~
/usr/local/include/g2o/stuff/tuple_tools.h:42:77: error: expected primary-expression before ‘)’ token
42 | f, t, i, std::make_index_sequence<std::tuple_size_v<std::decay_t<T>>>());
| ^
修改方法:
将原有的C++标准 改为14或17 根据ubuntu的版本
# set(CMAKE_CXX_FLAGS "-std=c++14 -O2 ${SSE_FLAGS} -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2")
set(CMAKE_CXX_FLAGS "-std=c++17 -O2 ${SSE_FLAGS} -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2")