关于ORB_SLAM2在Ubuntu16.04下编译出错的解决办法之一

来源:互联网 发布:网络打印机经常脱机 编辑:程序博客网 时间:2024/06/05 21:17

Ubuntu14.04一切正常,迁移到Ubuntu16.04后编译报错,提示:

/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:745:3: error: static assertion failed:YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY
  EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar);

 error log
 
问题原因:Eigen3的bug
解决方法:打开Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h,将以下代码
复制代码
1 template <typename MatrixType>2 class LinearSolverEigen: public LinearSolver<MatrixType>3 {4   public:5     typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix;6     typedef Eigen::Triplet<double> Triplet;7     typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, SparseMatrix::Index> PermutationMatrix;
复制代码

改为

复制代码
1 template <typename MatrixType>2 class LinearSolverEigen: public LinearSolver<MatrixType>3 {4   public:5     typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix;6     typedef Eigen::Triplet<double> Triplet;8     typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int> PermutationMatrix;9     /**
复制代码
0 0
原创粉丝点击