目录
第一个错误error: ‘CV_BGR2GRAY’ was not declared in this scope
第二个错误error: ‘CV_GRAY2BGR’ was not declared in this scope
第三个错误是没有那个文件或目录 26 | #include
第四个错误是‘CV_LOAD_IMAGE_UNCHANGED’ was not declared in this scope
第五个错误是static assertion failed:std::map must have the same value_type as its allocator
第六个错误是‘CvMat’ has not been declared/‘CV_GRAY2BGR’ was not declared in this scopeerror: ‘CV_RGB2GRAY’ was not declared in this scope
第七个错误是error: ’usleep’ was not declared in this scope
第八个错误是error: no match for call to ‘(pcl::getFieldIndex(const pcl::PCLPointCloud2&, const string&)::) (const pcl::PCLPointField&)’(int)>
第九个错误是error: ‘CV_REDUCE_SUM’ was not declared in this scope
第一个错误error: ‘CV_BGR2GRAY’ was not declared in this scope
解决办法是将CV_BGR2GRAY改为cv::COLOR_BGR2GRAY
第二个错误error: ‘CV_GRAY2BGR’ was not declared in this scope
解决办法是在头文件中添加 #include <opencv2/imgproc/types_c.h>,或者改成cv::COLOR_GRAY2BGR
第三个错误是没有那个文件或目录 26 | #include <opencv/cv.h>
解决方法是把#include <opencv/cv.h>改为#include <opencv2/imgproc.hpp>
第四个错误是‘CV_LOAD_IMAGE_UNCHANGED’ was not declared in this scope
解决办法是在指定文件中添加#include "opencv2/imgcodecs/legacy/constants_c.h"
第五个错误是static assertion failed:std::map must have the same value_type as its allocator
解决办法是在LoopClosing.h中修改
typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,
Eigen::aligned_allocator<std::pair<const KeyFrame*, g2o::Sim3> > > KeyFrameAndPose;
改为
typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,
Eigen::aligned_allocator<std::pair<KeyFrame* const, g2o::Sim3> > > KeyFrameAndPose;
第六个错误是‘CvMat’ has not been declared/‘CV_GRAY2BGR’ was not declared in this scope
error: ‘CV_RGB2GRAY’ was not declared in this scope
解决办法是
#include <opencv2/imgproc/types_c.h>
第七个错误是error: ’usleep’ was not declared in this scope
解决办法是#include <unistd.h>
第八个错误是error: no match for call to ‘(pcl::getFieldIndex(const pcl::PCLPointCloud2&, const string&)::<lambda(int)>) (const pcl::PCLPointField&)’
解决办法是在CMakeLists.txt文件中改为set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -O3")
第九个错误是error: ‘CV_REDUCE_SUM’ was not declared in this scope
解决办法是在文件中添加:#include<opencv2/core/core_c.h>
第十个报错是./tools/bin_vocabulary: error while loading shared libraries: libopencv_core3.so.3.1: cannot open shared object file: No such file or directory
解决办法是把ORB_SLAM2_modified文件夹下的CMakeLists.txt里面的opencv版本改为你自己的版本,还有ORB_SLAM2_modified/Thirdparty/DBoW2文件夹下的CMakeLists.txt里面的opencv版本改为你自己的版本