问题描述
编译Sophus时,遇到如下错误
Sophus/sophus/so2.hpp:106:40: error: ‘ScalarBinaryOpTraits’ in namespace ‘Eigen’ does not name a template type
using ReturnScalar = typename Eigen::ScalarBinaryOpTraits<
解决方法
Sophus需要3.3以上的版本,而我装的是3.1的版本,重新安装后编译通过
如何查看eigen版本
cat /usr/include/eigen3/Eigen/src/Core/util/Macros.h
#或者
cat /usr/local/include/eigen3/Eigen/src/Core/util/Macros.h
该头文件的前面几行有相关版本信息,如下
$ cat /usr/local/include/eigen3/Eigen/src/Core/util/Macros.h
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008-2015 Gael Guennebaud <gael.guennebaud@inria.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_MACROS_H
#define EIGEN_MACROS_H
#define EIGEN_WORLD_VERSION 3
#define EIGEN_MAJOR_VERSION 3
#define EIGEN_MINOR_VERSION 1
//这里版本即为3.3.1