0

当我运行时,make我得到了这个输出。如何使用 cmake 链接 g2o 库。CMake 在编写构建文件时没有问题。

[  7%] Linking CXX executable proj1
/usr/bin/ld: cannot find -lg2o_core_d
/usr/bin/ld: cannot find -lg2o_types_slam3d_d
/usr/bin/ld: cannot find -lg2o_solver_csparse_d
/usr/bin/ld: cannot find -lg2o_stuff_d
/usr/bin/ld: cannot find -lg2o_csparse_extension_d
/usr/bin/ld: cannot find -lg2o_types_sba_d
collect2: error: ld returned 1 exit status
CMakeFiles/proj1.dir/build.make:425: recipe for target 'proj1' failed
make[2]: *** [vo] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/proj1.dir/all' failed
make[1]: *** [CMakeFiles/proj1.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

这是我的 CMakeLists.txt 文件

cmake_minimum_required(VERSION 3.0)
project(proj1)

set(CMAKE_CXX_STANDARD 11)

set(SOURCE_FILES
        include1.hpp
        include2.hpp
        include3.hpp)

find_package( OpenCV REQUIRED )
find_package( Eigen3 REQUIRED )
include_directories( include ${OpenCV_INCLUDE_DIRS} )
include_directories( include ${Eigen_INCLUDE_DIRS} ${Boost_INCLUDE_DIR})
add_executable( proj1 ${SOURCE_FILES} )
target_link_libraries( proj1
        ${OpenCV_LIBS}
        ${Eigen_LIBS}

         g2o_core_d
         g2o_types_slam3d_d
         g2o_solver_csparse_d
         g2o_stuff_d
         g2o_csparse_extension_d
         g2o_types_sba_d

         g2o_core
         g2o_types_slam3d
         g2o_solver_csparse
         g2o_stuff
         g2o_csparse_extension
         g2o_types_sba

        )
4

0 回答 0