SLAM代码问题汇总

对‘cv::String::deallocate()’未定义的引用

检查CMakeLists.txt路径拼写
错误:target_link_libraries(gaussNewton ${OpenCV_INCLUDE_LIBS})
正确:target_link_libraries(gaussNewton ${OpenCV_LIBS})

出现fmt未引用

安装fmt然后

find_package( FMT REQUIRED )
arget_link_libraries(project_name fmt::fmt)

出现/usr/bin/ld: cannot find -lopencv_xxx

错误:find_package(OpenCV REQUIRED)
正确:改为find_package(OpenCV 3 REQUIRED)

出现/usr/local/include/g2o/core/base_fixed_sized_edge.hpp:179:14: error: ‘FixedArray {aka class ceres::internal::FixedArray<double, 9>}’ has no member named ‘fill’

add_vertex.fill(0.);
错误:安装了版本较低的ceres
正确:升级为2.0.0的Ceres
参考:https://blog.csdn.net/qq_41880787/article/details/123978918

出现undefined reference to symbol 'cs_di_calloc'

//usr/lib/x86_64-linux-gnu/libcxsparse.so.3: 无法添加符号: DSO missing from command line
原因:缺少cxsparse
解决方法:在CMakeLists.txt最后添加:

SET(G2O_LIBS g2o_cli g2o_ext_freeglut_minimal g2o_simulator g2o_solver_slam2d_linear g2o_types_icp g2o_types_slam2d g2o_core g2o_interface g2o_solver_csparse g2o_solver_structure_only g2o_types_sba g2o_types_slam3d g2o_csparse_extension g2o_opengl_helper g2o_solver_dense g2o_stuff g2o_types_sclam2d g2o_parser g2o_solver_pcg g2o_types_data g2o_types_sim3 cxsparse )
 
target_link_libraries(g2o_test ${G2O_LIBS})

参考:https://blog.csdn.net/nature1949/article/details/124516328
https://blog.csdn.net/unlimitedai/article/details/88698597

posted @ 2022-10-06 10:41  小帆敲代码  阅读(425)  评论(0编辑  收藏  举报