在编译时会出现如下错误:
已经显示编译完成100%后,会报错有关于无法linking的问题
[100%] Linking CXX executable ../VIO
../lib/libORB_SLAM2.so:对‘pangolin::Split(std::string const&, char)’未定义的引用
../lib/libORB_SLAM2.so:对‘pangolin::BindToContext(std::string)’未定义的引用
../lib/libORB_SLAM2.so:对‘DBoW2::FORB::toString(cv::Mat const&)’未定义的引用
../lib/libORB_SLAM2.so:对‘pangolin::CreateWindowAndBind(std::string, int, int, pangolin::Params const&)’未定义的引用
../lib/libORB_SLAM2.so:对‘DBoW2::FORB::fromString(cv::Mat&, std::string const&)’未定义的引用
../lib/libORB_SLAM2.so:对‘pangolin::CreatePanel(std::string const&)’未定义的引用
错误原因:
并不是pytorch版本问题,更和是否使用源码安装pytorch和libtorch无关。
真正的原因是因为没有使用包含有 CXX11-abi 版本的libtorch
pytorch官网提供有两种下载链接:
1.
https://download.pytorch.org/libtorch/cu101/libtorch-shared-with-deps-1.X.X.zip
2.
https://download.pytorch.org/libtorch/cu101/libtorch-cxx11-abi-shared-with-deps-1.X.X.zip
其中第二种才是带有CXX-abi的libtorch,请使用这个版本的libtorch
更换libtorch后,问题解决!
解决方案原链接:
https://www.cnblogs.com/zherlock/p/12771136.html
libtorch历史版本链接:不带CXX11-abi
https://blog.csdn.net/lxx4610/article/details/105806017/