#添加OpenCV库,头文件
find_package(OpenCV REQUIRED)
include_directories(${OPENCV_INCLUDE_DIRS})
#添加Eigen库,头文件
find_package(Eigen3)
include_directories(${EIGEN3_INCLUDE_DIRS})
#添加Ceres库,头文件
find_package(Ceres REQUIRED)
include_directories(${CERES_INCLUDE_DIRS})
#添加G2O库,头文件
LIST(APPEND CMAKE_MODULE_PATH /home/carl/g2o/cmake_modules)
SET(G2O_ROOT /home/carl/g2o)
find_package(G2O REQUIRED)
include_directories(${G2O_INCLUDE_DIRS})

add_executable(ceres_quxian main.cpp)

#链接库文件到工程
target_link_libraries(ceres_quxian ${OpenCV_LIBS} ${CERES_LIBRARIES} g2o_core g2o_stuff)

头文件

#include <Eigen/Core>
#include <Eigen/Dense>
error: while loading shared libraries: libg2o_core.so: cannot open shared object file: No such file or directory

解决方法:

build文件夹下
sudo ldconfig
刚装上未生效
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐