在编译包含Sophus的源文件的时候,出现如下错误

../lib/libmyslam.so: undefined reference to `Sophus::SO3::SO3(double, double, double)'
../lib/libmyslam.so: undefined reference to `Sophus::SE3::operator*(Eigen::Matrix<double, , , , , > const&) const'
../lib/libmyslam.so: undefined reference to `Sophus::SE3::SE3(Sophus::SO3 const&, Eigen::Matrix<double, , , , , > const&)'
../lib/libmyslam.so: undefined reference to `Sophus::SE3::operator*(Sophus::SE3 const&) const'
../lib/libmyslam.so: undefined reference to `Sophus::SE3::log() const'
../lib/libmyslam.so: undefined reference to `Sophus::SE3::operator=(Sophus::SE3 const&)'
../lib/libmyslam.so: undefined reference to `Sophus::SE3::inverse() const'
../lib/libmyslam.so: undefined reference to `Sophus::SE3::SE3()'
../lib/libmyslam.so: undefined reference to `Sophus::SE3::SE3(Sophus::SE3 const&)'
collect2: error: ld returned exit status

原因分析:
安装Sophus时,有个lib文件“libSophus.so”会出现在/usr/local/lib/libSophus.so
(本人编译时最后执行了 sudo make install, 因此在系统文件夹里面有该lib文件)。
当执行FIND_PACKAGE(sophus REQUIRED)时,libSophus.so 应该被链接到 Sophus_LIBRARIES,
但cmake却没链接上。

决办法:
显式将Sophus_LIBRARIES 链接到libSophus.so,CMakeLists.txt的代码如下:

cmake_minimum_required( VERSION 2.8 )
project( useSophus ) # 为使用 sophus,您需要使用find_package命令找到它
find_package( sophus REQUIRED )
set(Sophus_LIBRARIES "/home/guorun/vision_slam/slambook/3rdparty/Sophus/libSophus.so")
include_directories("/usr/include/eigen3")
include_directories( ${Sophus_INCLUDE_DIRS} ) add_executable( useSophus useSophus.cpp )
target_link_libraries( useSophus ${Sophus_LIBRARIES} )

即可成功。

以上使用的是老版本的Sophus,新版本的还未测试!!!

Sophus libSophus.so的更多相关文章

  1. cmake find_package 中,include_directories,target_link_libraries 的值怎么知道?

    拿Sophus库为例: find_package(Sophus REQUIRED) include_directories(${Sophus_INCLUDE_DIRS}) target_link_li ...

  2. Sophus链接错误

    错误指示如下: CMakeFiles/run_vo.dir/run_vo.cpp.o: In function `main': run_vo.cpp:(.text.startup+0x1086): u ...

  3. Sophus库CMakeLists.txt内容详解笔记

    CMakeLists.txt: SET(PROJECT_NAME Sophus) PROJECT(${PROJECT_NAME}) CMAKE_MINIMUM_REQUIRED(VERSION 2.6 ...

  4. Could not find a package configuration file provided by "Sophus",SophusConfig.cmake

    CMake Error at CMakeLists.txt:5 (find_package): By not providing "FindSophus.cmake" in CMA ...

  5. ubuntu16.04下安装Sophus

    git clone https://github.com/strasdat/Sophus.git 下载完成后 cd Sophus git checkout a621ffmkdir buildcd bu ...

  6. Sophus VS2010编译不支持?C++11语法的缘故。那有没有不带C++11特性的Sophus版本呢?

    Eigen:3.1 3.0 Ceres:No Sophus: Sophus支不支持Windows编译?官网写的是通过了Windows的编译的 linux, os x:  windows:  code ...

  7. 使用Sophus练习李群SO3、SE3以及对应的李代数so3、se3

    这是高博<视觉SLAM14讲,从理论到实践>第4章的练习.加了一些注释和理解: #include <iostream>#include <cmath>using n ...

  8. SLAM十四讲中Sophus库安装

    Sophus截止目前有很多版本,其中大体分为两类,一种是用模板实现的方法,一种是用非模板类实现的,SLAM十四讲中使用的是非模板类库,clone Sophus: git clone http://gi ...

  9. 如何安装Eigen库和Sophus库

    * { font-family: "Tibetan Machine Uni", "sans-serif", STFangSong; outline: none ...

随机推荐

  1. 下载excel

    使用struts2的方式完成下载 对于下载excel2003,contentType如此设置 <result name="success" type="stream ...

  2. python 多线程操作数据库

    如果使用多线程操作数据库,容易引起多用户操作锁表 OperationalError: (2013, 'Lost connection to MySQL server during query') 使用 ...

  3. 五 shutil模块

    高级的 文件.文件夹.压缩包 处理模块 shutil.copyfileobj(fsrc, fdst[, length])将文件内容拷贝到另一个文件中 1 import shutil 2 3 shuti ...

  4. idea插件推荐

    CodeGlance 类似SublimeText的Mini Map插件  Background Image Plus 这又是一款装备B插件了,想想别人看到你的IDE有个美女或者异次元背景是怎样的,安装 ...

  5. windows下python文件与文件夹操作

    一.导入模块 imoprt os 二.获取python当前执行的目录 s=os.getcwd() 三.创建文件 import datetime import os dtime=datetime.dat ...

  6. 【转】收集 jetty、tomcat、jboss、weblogic 的比较

    jetty Jetty 是一个开源的servlet容器,它为基于Java的web容器,例如JSP和servlet提供运行环境.Jetty是使用Java语言编写的,它的API以一组JAR包的形式发布.开 ...

  7. string类的一些函数方法

    1.请查看String.equals()方法的实现代码,注意学习其实现方法: (1)源程序: public class StringEquals { /** * @param args the com ...

  8. label 和input/textarea居中对齐

    设置label和input/textarea的vertical-align: middle;即可实现垂直方向居中对齐.有时候可能会有偏差,设置input的margin-top使看上去居中对齐

  9. python 中 类型转换 bytes

    https://www.cnblogs.com/sesshoumaru/p/5980090.html

  10. 无法打开这些文件internet安全设置

    在安装别人传过来的软件的时候 出现这种情况 解决: 对这个程序,右键“属性”,可以看到属性窗口下方提示:此文件来自其它的电脑,可能不安全,后面有个按钮“解除锁定”