在Ubuntu 18.04编译ORB-SLAM2时,出现关于eigien的deprecated错误

在Ubuntu 18.04编译ORB-SLAM2时,出现关于eigien的deprecated错误,如下:

In file included from /home/hri/rosbuild_ws/package_dir/ORB_SLAM2_Fusion/Thirdparty/g2o/g2o/types/types_six_dof_expmap.h:37:0,
                 from /home/hri/rosbuild_ws/package_dir/ORB_SLAM2_Fusion/include/Converter.h:29,
                 from /home/hri/rosbuild_ws/package_dir/ORB_SLAM2_Fusion/src/Converter.cc:22:
/home/hri/rosbuild_ws/package_dir/ORB_SLAM2_Fusion/Thirdparty/g2o/g2o/types/../core/base_vertex.h:62:74: warning: ‘Eigen::AlignedBit’ is deprecated [-Wdeprecated-declarations]
     typedef Eigen::Map, Matrix::Flags & AlignedBit ? Aligned : Unaligned >  HessianBlockType;
                                                                          ^~~~~~~~~~
In file included from /usr/local/include/eigen3/Eigen/Core:363:0,
                 from /usr/local/include/eigen3/Eigen/Dense:1,
                 from /home/hri/rosbuild_ws/package_dir/ORB_SLAM2_Fusion/include/Converter.h:26,
                 from /home/hri/rosbuild_ws/package_dir/ORB_SLAM2_Fusion/src/Converter.cc:22:
/usr/local/include/eigen3/Eigen/src/Core/util/Constants.h:162:37: note: declared here
 EIGEN_DEPRECATED const unsigned int AlignedBit = 0x80;
                                     ^~~~~~~~~~
In file included from /home/hri/rosbuild_ws/package_dir/ORB_SLAM2_Fusion/Thirdparty/g2o/g2o/types/types_six_dof_expmap.h:38:0,
                 from /home/hri/rosbuild_ws/package_dir/ORB_SLAM2_Fusion/include/Converter.h:29,
                 from /home/hri/rosbuild_ws/package_dir/ORB_SLAM2_Fusion/src/Converter.cc:22:
/home/hri/rosbuild_ws/package_dir/ORB_SLAM2_Fusion/Thirdparty/g2o/g2o/types/../core/base_binary_edge.h:59:82: warning: ‘Eigen::AlignedBit’ is deprecated [-Wdeprecated-declarations]
       typedef Eigen::Map, Matrix::Flags & AlignedBit ? Aligned : Unaligned > HessianBlockType;
....

解决办法:

出现这个问题是因为安装的eigen版本太高,需要降低到3.2.1版本。
我原本装的是eigen-3.3.7,降低到3.3.2仍旧出现这个问题,因此建议降低到3.2.1版本(链接待审核通过后再附上)。
操作方法如下:

1. 卸载原本的eigen:

# sudo rm -rf /usr/local/include/eigen3

2. 下载eigen-3.2.1版本,并解压缩进入文件夹,执行如下命令:

# mkdir build && cd build
# sudo make install

3. 重新编译Pangolin, DBoW2, g2o, ORB_SLAM2

你可能感兴趣的:(ORB-SLAM2)