赞
踩
编译程序时遇到如下报错:
/home/ubuntu/workspace_demo/***/devel/lib/libvikit_common.so: undefined reference to `Sophus::SE3::operator*(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&) const'
/home/ubuntu/workspace_demo/***/devel/lib/libvikit_common.so: undefined reference to `Sophus::SE3::operator=(Sophus::SE3 const&)'
/home/ubuntu/workspace_demo/***/devel/lib/libvikit_common.so: undefined reference to `Sophus::SE3::SE3()'
/home/ubuntu/workspace_demo/***/devel/lib/libvikit_common.so: undefined reference to `Sophus::SE3::SE3(Eigen::Matrix<double, 3, 3, 0, 3, 3> const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)'
/home/ubuntu/workspace_demo/***/devel/lib/libvikit_common.so: undefined reference to `Sophus::SE3::exp(Eigen::Matrix<double, 6, 1, 0, 6, 1> const&)'
/home/ubuntu/workspace_demo/***/devel/lib/libvikit_common.so: undefined reference to `Sophus::SE3::SE3(Sophus::SE3 const&)'
/home/ubuntu/workspace_demo/***/devel/lib/libvikit_common.so: undefined reference to `Sophus::SE3::operator*(Sophus::SE3 const&) const'
/home/ubuntu/workspace_demo/***/devel/lib/libvikit_common.so: undefined reference to `Sophus::SO3::matrix() const'
安装非模板类的 Sophus 时,执行完sudo make install
,有一个库文件libSophus.so
会安装在/usr/local/lib/libSophus.so
。 当在CMake中使用 FIND_PACKAGE(sophus REQUIRED)
时,libSophus.so
应该被链接到 Sophus_LIBRARIES
, 但cmake却没链接上。
所以,需要在报错的文件所对应的CMakeList.txt
中显示链接到 libSophus.so
find_package(sophus REQUIRED)
set(Sophus_LIBRARIES libSophus.so)
include_directories( ${Sophus_INCLUDE_DIRS} )
target_link_libraries(${PROJECT_NAME} ${Sophus_LIBRARIES})
[1] huangweibo. Sophus 编译错误 [EB/OL]. https://blog.csdn.net/u010003609/article/details/68961293, 2017-04-03/2022-11-21.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。