zoukankan      html  css  js  c++  java
  • Sophus链接错误

    错误指示如下:

    CMakeFiles/run_vo.dir/run_vo.cpp.o: In function `main':
    run_vo.cpp:(.text.startup+0x1086): undefined reference to `Sophus::SE3::inverse() const'
    run_vo.cpp:(.text.startup+0x10c9): undefined reference to `Sophus::SO3::matrix() const'
    run_vo.cpp:(.text.startup+0x10ec): undefined reference to `Sophus::SO3::matrix() const'
    run_vo.cpp:(.text.startup+0x110f): undefined reference to `Sophus::SO3::matrix() const'
    run_vo.cpp:(.text.startup+0x1132): undefined reference to `Sophus::SO3::matrix() const'
    run_vo.cpp:(.text.startup+0x1155): undefined reference to `Sophus::SO3::matrix() const'
    CMakeFiles/run_vo.dir/run_vo.cpp.o:run_vo.cpp:(.text.startup+0x1178): more undefined references to `Sophus::SO3::matrix() const' follow
    ../../lib/libmyslam.so: undefined reference to `Sophus::SE3::SE3(Sophus::SO3 const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)'
    ../../lib/libmyslam.so: undefined reference to `Sophus::SE3::operator=(Sophus::SE3 const&)'
    ../../lib/libmyslam.so: undefined reference to `Sophus::SE3::SE3()'
    ../../lib/libmyslam.so: undefined reference to `Sophus::SE3::SE3(Sophus::SE3 const&)'
    ../../lib/libmyslam.so: undefined reference to `Sophus::SO3::SO3(double, double, double)'
    ../../lib/libmyslam.so: undefined reference to `Sophus::SE3::log() const'
    ../../lib/libmyslam.so: undefined reference to `Sophus::SE3::operator*(Sophus::SE3 const&) const'
    ../../lib/libmyslam.so: undefined reference to `Sophus::SE3::operator*(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&) const'
    collect2: error: ld returned 1 exit status
    test/CMakeFiles/run_vo.dir/build.make:143: recipe for target '../bin/run_vo' failed
    make[2]: *** [../bin/run_vo] Error 1
    CMakeFiles/Makefile2:140: recipe for target 'test/CMakeFiles/run_vo.dir/all' failed
    make[1]: *** [test/CMakeFiles/run_vo.dir/all] Error 2
    Makefile:83: recipe for target 'all' failed
    make: *** [all] Error 2

    CMakeLists.txt中的Sophus

    # Sophus
    find_package( Sophus REQUIRED )
    include_directories( ${Sophus_INCLUDE_DIRS} )

    原因分析:
    安装Sophus时,有个lib文件“libSophus.so”会出现在/usr/local/lib/libSophus.so 时,libSophus.so 应该被链接到 Sophus_LIBRARIES, cmake没链接上。

    应该更改为

    # Sophus
    find_package( Sophus REQUIRED )
    set(Sophus_LIBRARIES libSophus.so)
    include_directories( ${Sophus_INCLUDE_DIRS} )

    即显示链接Sophus_LIBRARIES 链接到libSophus.so

    # Sophus
    find_package( Sophus REQUIRED )
    set(Sophus_LIBRARIES libSophus.so)
    include_directories( ${Sophus_INCLUDE_DIRS} )
  • 相关阅读:
    传奇检测命令大全(常用命令)
    传奇版本中利用NPC迅速给人物加血脚本制作
    传奇泡点地图制作脚本
    双击包裹物品自动解包设置方法_传奇版本技术
    传奇地图事件触发脚本
    单机架设传奇服务器第47课:定时器OnTimer功能详解
    单机架设传奇服务器:机器人运行脚本文件
    检测某个地图某个怪物的数量的脚本
    检测当前人物是否在安全区脚本命令
    假人配置说明
  • 原文地址:https://www.cnblogs.com/gary-guo/p/9467791.html
Copyright © 2011-2022 走看看