您的位置:首页 > 运维架构 > Linux

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

2016-10-11 19:15 393 查看
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     /**


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux ubuntu 解决方案