1. 程式人生 > >orbslam編譯錯誤error: static assertion failed

orbslam編譯錯誤error: static assertion failed

Ubuntu16.04後編譯報錯,提示:

/usr/local/include/eigen3/Eigen/src/Core/util/StaticAssert.h:32:40: error: static assertion failed: YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY
     #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);

問題原因:Eigen3的bug

解決方法:開啟Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h,將以下程式碼

typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, SparseMatrix::Index> PermutationMatrix;

替換為

typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int> PermutationMatrix;