先对g2o的依赖库进行安装:
sudo apt-get update sudo apt-get install libeigen3-dev sudo apt-get install libsuitesparse-dev sudo apt-get install qtdeclarative5-dev sudo apt-get install qt5-qmake sudo apt-get install libqglviewer-dev-qt5
然后下载g2o(2020那个版本)
地址:https://github.com/RainerKuemmerle/g2o/tree/20200410_git
然后在解压后的g2o文件目录下输入:
mkdir build cd build sudo ldconfig cmake .. make j2
CMakeLists.txt引用g2o:
LIST( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules ) SET( G2O_ROOT /usr/local/include/g2o ) find_package(G2O REQUIRED) include_directories(${G2O_INCLUDE_DIRS}) add_executable(g2oCurveFitting g2oCurveFitting.cpp) target_link_libraries(g2oCurveFitting g2o_core g2o_stuff ${OpenCV_LIBS})
之后编译时出现下面问题
Please set them or make sure they are set and tested correctly in the CMake files: G2O_INCLUDE_DIRS
used as include directory in directory /home/xj/slambook2-master/ch6
used as include directory in directory /home/xj/slambook2-master/ch6
used as include directory in directory /home/xj/slambook2-master/ch6
是因为cmake_modules写成了cmake_module
————————————————
版权声明:本文为CSDN博主「壹609」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_66001915/article/details/131127507
其它链接:Ubuntu16.04安装视觉SLAM环境(g2o)
标签:include,get,sudo,apt,directory,g2o,ubuntu18.04,安装 From: https://www.cnblogs.com/rainbow70626/p/17655021.html