问题一:/ORB_SLAM2_PointCloud/src/pointcloudmapping.cc:42:24: error: ‘make_shared’ is not a member of ‘boost’42 | globalMap = boost::make_shared< PointCloud >( );
解决办法:添加#include <boost/make_shared.hpp>
问题二:error: ‘plusscalar’ is not a member of ‘pcl::traits’
698 | POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointDEM,
解决办法:找到CMakeLists.txt文件,加入
set(CMAKE_CXX_STANDARD 14)
问题三:error: ‘CV_RGB2GRAY’ was not declared in this scope
177 | cvtColor(mImGray,mImGray,CV_RGB2GRAY);
解决办法:在头文件里添加 #include <opencv2/imgproc/types_c.h>
问题四:error: ‘CvMat’ does not name a type
102 | void find_betas_approx_1(const CvMat * L_6x10, const CvMat * Rho, double * betas);
解决办法:添加头文件
#include <opencv2/core/types_c.h>
问题五
error: ‘cvCreateMat’ was not declared in this scope; did you mean ‘cvCreateSparseMat’?
error: ‘cvMulTransposed’ was not declared in this scope
error: ‘CV_SVD_MODIFY_A’ was not declared in this scope; did you mean ‘CV_HAL_SVD_MODIFY_A’
error: ‘CV_SVD_U_T’ was not declared in this scope
error: ‘cvSVD’ was not declared in this scope
error: ‘cvReleaseMat’ was not declared in this scope
error: ‘CV_SVD’ was not declared in this scope; did you mean ‘CV_AVX’?
error: ‘cvInvert’ was not declared in this scope; did you mean ‘cvInvSqrt’?
error: ‘cvCreateMat’ was not declared in this scope; did you mean ‘cvCreateSparseMat’?
error: ‘cvMulTransposed’ was not declared in this scope
error: ‘CV_SVD_MODIFY_A’ was not declared in this scope; did you mean ‘CV_HAL_SVD_MODIFY_A’?
error: ‘CV_SVD_MODIFY_A’ was not declared in this scope; did you mean ‘CV_HAL_SVD_MODIFY_A’?
解决方法:
#include <opencv2/imgproc/types_c.h>
#include <opencv2/imgproc.hpp>
问题六error:static assertion failed:std::map must have the same value_type as its allocator
解决方法: 在ORB_SLAM2的安装路径下打开 /include 文件夹,在 LoopClosing.h 中修改第49-50行,将
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;
问题七/usr/include/pcl-1.10/pcl/pcl_config.h:7:4: error: #error PCL requires C++14 or above| #error PCL requires C++14 or above
解决方案修改/ORB_SLAM2_modified/CMakeLists.txt文件-std=c++11换成-std=c++14