/home/xtdrone/catkin_ws/src/ORB_SLAM2/src/Optimizer.cc:818:37:   required from here
/usr/include/c++/9/bits/stl_map.h:122:71: error: static assertion failed: std::map must have the same value_type as its allocator
  122 |       static_assert(is_same<typename _Alloc::value_type, value_type>::value,
      |                                                                       ^~~~~



/home/xtdrone/catkin_ws/src/ORB_SLAM2/src/LoopClosing.cc:438:21:   required from here
/usr/include/c++/9/bits/stl_map.h:122:71: error: static assertion failed: std::map must have the same value_type as its allocator
  122 |       static_assert(is_same<typename _Alloc::value_type, value_type>::value,
      |                                                                       ^~~~~

运行build.sh脚本遇到以上报错、

根据参考链接

修改了include文件中的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;

参考文章:ORB-SLAM2环境配置及运行_orbslam2环境配置-CSDN博客

更多推荐