eigen3和g2o發生衝突

 

 

/usr/include/eigen3/Eigen/src/Core/util/StaticAssert.h:32: 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 和g2o衝突了

解決方法:打開Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h,將以下代碼:

 template <typename MatrixType>
class LinearSolverEigen: public LinearSolver<MatrixType>
 {
   public:
    typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix;
    typedef Eigen::Triplet<double> Triplet;
    typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, SparseMatrix::Index> PermutationMatrix;

 改成                                       
 template <typename MatrixType>
 class LinearSolverEigen: public LinearSolver<MatrixType>
 {
  public:
    typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix;    
 typedef Eigen::Triplet<double> Triplet;

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

 stackoverflow裏面還有人說通過解決更新換最新的eigen試試。通過改代碼有後遺症。

eigen3和g2o發生衝突

 

參考:http://www.bubuko.com/infodetail-2149690.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章