如何在Ubuntu 14.04中安装eigen 3.3?

我正在使用Ubuntu 14.04,我想在Ubuntu中安装eigen 3.3。 我尝试下载最新版本的Eigen 3(3.3)并安装如下

mkdir build cd build cmake .. make sudo make install 

输出喜欢

 -- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/Skyline/SkylineStorage.h -- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/SparseExtra/RandomSetter.h -- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/SparseExtra/MarketIO.h -- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/SparseExtra/BlockOfDynamicSparseMatrix.h -- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h -- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h -- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/Splines/SplineFwd.h -- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/Splines/SplineFitting.h -- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/Splines/Spline.h 

但是,当我用dpkg -p libeigen3-dev检查我当前的本征版本时,输出为

 Package: libeigen3-dev Priority: extra Section: libdevel Installed-Size: 3729 Maintainer: Ubuntu Developers  Architecture: all Source: eigen3 Version: 3.2.0-8 Provides: libeigen2-dev Depends: pkg-config Suggests: libeigen3-doc, libmrpt-dev Size: 494158 

它显示我的设置没有完成。 如何在我的Ubuntu中安装本征版本? 谢谢大家

在源代码中使用CmakeList.txt进行编译时出错

 -- =============================================================== -- ============ Configuring CompileSettings ===================== -- =============================================================== -- ============= Look for required libraries ===================== -- Looking for Eigen Library with minimum version 3.2.90 -- Looking for Eigen via User Provided (or Cached) location -- Eigen version 3.2.0 found in /usr/include/eigen3 CMake Warning at cmake/FindEigen.cmake:62 (message): Eigen version is less than requred version 3.2.90 Call Stack (most recent call first): cmake/FindEigen.cmake:73 (Eigen_Check_Version) CMakeLists.txt:23 (FIND_PACKAGE) CMake Error at /usr/local/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message): Could NOT find Eigen (missing: EIGEN_VERSION_OK) (Required is at least version "3.2.90") Call Stack (most recent call first): /usr/local/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE) cmake/FindEigen.cmake:74 (find_package_handle_standard_args) CMakeLists.txt:23 (FIND_PACKAGE) 

Eigen c ++是一个仅限标题的库:您不必安装它,只需下载它,解压缩它并将代码链接到它。

例如,如果您的代码位于my_favorite_cpp_folder ,则执行以下操作:

 cd my_favorite_cpp_folder 

并且,假设您的编译器是gcc并且特征标头位于/usr/local/include/eigen3/unsupported/并且源文件的名称是my_favorite_cpp_source_file.cpp ,则通过执行以下操作编译并编码并将其链接到特征标头:

 g++ -I /usr/local/include/eigen3/ my_favorite_cpp_source_file.cpp -o my_favorite_cpp_source_file 

(从上面发布的代码输出中,本征头位于计算机中的/usr/local/include/eigen3/

对于那些只需要在Ubuntu上使用相当近期版本的Eigen 3和类似的基于Debian的发行版( ……这是常见情况 )的人来说,安装现有的libeigen3-dev软件包就足够了: 例如,

 sudo apt install libeigen3-dev 

对于大多数用例来说,手动下载和安装Eigen 3可能有点过分。

dpkg只知道您使用Ubuntu标准软件包管理工具安装的软件。 但那不是你安装本征的方式。 您已从源代码安装,因此dpkg不知道它。 dpkg -p libeigen3-dev的输出与您安装的特征无关,而是与使用标准软件包管理工具安装的不同版本的特征有关。

根据你的sudo make install输出,你从源安装的eigen版本已经可以使用了,它的文件可以在/usr/local/include/eigen3/unsupported/Eigen/src

解压缩压缩文件夹后,检查INSTALL文件。 我使用了第二个使用cmake安装的选项。 之后在/usr/local/include/文件夹中创建了带有头文件的“eigen3”文件夹。

在您的项目中,您可以包含这样的特征标题:

 #include  

我忘了提这个。 由于头文件位于/usr/local/include/文件夹中,因此您无需使用“ g++ -I ….”编译源代码文件。

祝好运!