1. 问题:target_compile_features specified unknown feature “cxx_std_14” for target "core"
解决方案:cmake版本需要3.3以上,我选择3.3.15cmake通过
cmake地址:https://cmake.org/files(找到最新版) 执行 : tar xvf cmake-3.15.0.tar.gz 找到cmake文件并卸载 不能直接sudo apt remove --purge cmake locate cmake //在usr路径下删除cmake的文件 之后进行: ./configure make -j8 sudo make install cmake --version//查看安装版本
2.问题:error: ‘index_sequence’ is not a member of 'std’
解决方法:所以需要把CMakeLists.txt文件中改为C++14编译。
将 set( CMAKE_CXX_FLAGS "-std=c++11" ) 改成 set( CMAKE_CXX_FLAGS "-std=c++14" )
3.问题 error: ‘VertexSBAPointXYZ’ is not a member of ‘g2o’
解决方案:
新版g2o库中不再存在原先的VertexSBAPointXYZ,将所有报错的地方改为VertexPointXYZ即可:
或者是
g2o 20200410_git版本也可以解决,该版本使用VertexSBAPointXYZ这个 https://github.com/RainerKuemmerle/g2o/archive/refs/tags/20200410_git.zip
4.问题 usr/local/include/g2o/core/base_fixed_sized_edge.hpp:166:14: error: ‘FixedArray {aka class ceres::internal::FixedArray
解决方案:因为新版本不兼容问题,需要将g2o版本换成 20200410_git版本, https://github.com/RainerKuemmerle/g2o/archive/refs/tags/20200410_git.zip
- 问题 DSO missing的原因基本上是因为有库没有连接上,导致未识别。最保险的方法是在最前端将所有库设置为G2O_LIBS:还有所用到的头文件名称
头名称:
#include#include // #include #include #include #include // #include #include #include #include #include #include #include #include #include #include #include #include
cmakelist.txt
include(cmake/FindG2O.cmake)
include(cmake/FindCSparse.cmake)
include_directories(
cmake
${OpenCV_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${Sophus_INCLUDE_DIRS}
${CSPARSE_INCLUDE_DIR}
)
target_link_libraries(project_name #工程名称
${catkin_LIBRARIES}
${OpenCV_LIBS} fmt
${EIGEN3_LIBS}
${EIGEN_DEFINITIONS}
${Sophus_LIBRARIES}
g2o_core g2o_stuff g2o_types_sba g2o_csparse_extension g2o_types_slam3d
${CSPARSE_LIB}
)



