VINS bug 调试 : undefined reference to `cv::FileStorage::FileStorage(std::__cxx11::basic_string<char, std::char_traits<char>,

CMakeFiles/vins_estimator.dir/src/parameters.cpp.o: In function `readParameters(ros::NodeHandle&)':
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:46: undefined reference to `cv::FileStorage::FileStorage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/vins_estimator.dir/src/parameters.cpp.o: In function `readParameters(ros::NodeHandle&)':
/usr/include/opencv4/opencv2/core/persistence.hpp:1264: undefined reference to `cv::read(cv::FileNode const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/vins_estimator.dir/src/parameters.cpp.o: In function `readParameters(ros::NodeHandle&)':
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:54: undefined reference to `cv::FileNode::operator double() const'
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:55: undefined reference to `cv::FileNode::operator int() const'
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:56: undefined reference to `cv::FileNode::operator double() const'
CMakeFiles/vins_estimator.dir/src/parameters.cpp.o: In function `readParameters(ros::NodeHandle&)':
/usr/include/opencv4/opencv2/core/persistence.hpp:1264: undefined reference to `cv::read(cv::FileNode const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/vins_estimator.dir/src/parameters.cpp.o: In function `readParameters(ros::NodeHandle&)':
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:70: undefined reference to `cv::FileNode::operator double() const'
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:71: undefined reference to `cv::FileNode::operator double() const'
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:72: undefined reference to `cv::FileNode::operator double() const'
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:73: undefined reference to `cv::FileNode::operator double() const'
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:74: undefined reference to `cv::FileNode::operator double() const'
CMakeFiles/vins_estimator.dir/src/parameters.cpp.o:/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:75: more undefined references to `cv::FileNode::operator double() const' follow
CMakeFiles/vins_estimator.dir/src/parameters.cpp.o: In function `readParameters(ros::NodeHandle&)':
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:79: undefined reference to `cv::FileNode::operator int() const'
CMakeFiles/vins_estimator.dir/src/parameters.cpp.o: In function `readParameters(ros::NodeHandle&)':
/usr/include/opencv4/opencv2/core/mat.inl.hpp:568: undefined reference to `cv::Mat::updateContinuityFlag()'
/usr/include/opencv4/opencv2/core/mat.inl.hpp:568: undefined reference to `cv::Mat::updateContinuityFlag()'
CMakeFiles/vins_estimator.dir/src/parameters.cpp.o: In function `readParameters(ros::NodeHandle&)':
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:118: undefined reference to `cv::FileNode::operator double() const'
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:119: undefined reference to `cv::FileNode::operator int() const'
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:125: undefined reference to `cv::FileNode::operator int() const'
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/parameters.cpp:128: undefined reference to `cv::FileNode::operator double() const'
CMakeFiles/vins_estimator.dir/src/estimator.cpp.o: In function `cv::Mat::Mat(int, int, int, void*, unsigned long) [clone .constprop.4076]':
/usr/include/opencv4/opencv2/core/mat.inl.hpp:568: undefined reference to `cv::Mat::updateContinuityFlag()'
/usr/include/opencv4/opencv2/core/mat.inl.hpp:561: undefined reference to `cv::error(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, char const*, int)'
/usr/include/opencv4/opencv2/core/mat.inl.hpp:548: undefined reference to `cv::error(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, char const*, int)'
CMakeFiles/vins_estimator.dir/src/estimator.cpp.o: In function `void cv::cv2eigen<double>(cv::Mat const&, Eigen::Matrix<double, -1, -1, 0, -1, -1>&) [clone .constprop.3981]':
/usr/include/opencv4/opencv2/core/mat.inl.hpp:568: undefined reference to `cv::Mat::updateContinuityFlag()'
/usr/include/opencv4/opencv2/core/mat.inl.hpp:548: undefined reference to `cv::error(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, char const*, int)'
CMakeFiles/vins_estimator.dir/src/estimator.cpp.o: In function `Estimator::initialStructure()':
/usr/include/opencv4/opencv2/core/mat.inl.hpp:1711: undefined reference to `cv::error(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, char const*, int)'
CMakeFiles/vins_estimator.dir/src/utility/visualization.cpp.o: In function `printStatistics(Estimator const&, double)':
/home/isee324/catkin_ws/src/VINS-Mono-master/vins_estimator/src/utility/visualization.cpp:79: undefined reference to `cv::FileStorage::FileStorage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/vins_estimator.dir/src/utility/visualization.cpp.o: In function `printStatistics(Estimator const&, double)':
/usr/include/opencv4/opencv2/core/mat.inl.hpp:568: undefined reference to `cv::Mat::updateContinuityFlag()'
/usr/include/opencv4/opencv2/core/mat.inl.hpp:568: undefined reference to `cv::Mat::updateContinuityFlag()'
CMakeFiles/vins_estimator.dir/src/utility/visualization.cpp.o: In function `printStatistics(Estimator const&, double)':
/usr/include/opencv4/opencv2/core/persistence.hpp:1219: undefined reference to `cv::operator<<(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/include/opencv4/opencv2/core/persistence.hpp:1208: undefined reference to `cv::write(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Mat const&)'
/usr/include/opencv4/opencv2/core/persistence.hpp:1219: undefined reference to `cv::operator<<(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/include/opencv4/opencv2/core/persistence.hpp:1208: undefined reference to `cv::write(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Mat const&)'

在VINS 的catkin_make 过程中,出现了以上的undefined问题,网上是了很多办法都不行,最后看到一个关于opencv路径的问题,这里的路径是:

/usr/include/opencv4/opencv2

很是奇怪,所以更改了cv_bridgeConfig.cmake里面的include 语句。

需要用到下面的命令行:

pkg-config --cflags opencv(查看系统的opencv路径在那里)

我的路径显示的是  -I/usr/local/include/opencv           -I/usr/local/include

在cv_bridgeConfig.cmake里将原来的路径改为以后两个路经。

原本是这个路经  set(_include_dirs "include;/usr/local/include;/usr/local/include/opencv4")
改完后 是:   set(_include_dirs "include;/usr/local/include;/usr/local/include/opencv")

然后,catkin_make ,

done : ) !

posted @ 2021-03-05 19:08  Respirar  阅读(2124)  评论(0编辑  收藏  举报