本征是一个用于线性代数的 C++ 模板库:矩阵、向量、数值解算器和相关算法。我在安装它时遇到了麻烦。当我运行从下载的 tarball 中提取的源目录的位置在cmake '/home/brentonhorne/eigen-eigen-5097c01bcdc4
哪里时/home/brentonhorne/eigen-eigen-5097c01bcdc4
Eigen 网站,我收到错误:
CMake Error at CMakeLists.txt:8 (message):
In-source builds not allowed. Please make a new directory (called a build
directory) and run CMake from there. You may need to remove
CMakeCache.txt.
-- Configuring incomplete, errors occurred!
请告诉我如何克服这个障碍。我不太懂编程,但如果你能向我解释我需要做什么,比如要把什么粘贴到终端里,我就可以做到!如果需要帮助的话,我正在运行 12.10。
如果您需要了解源目录中 INSTALL 文件的内容,则它们位于:
Installation instructions for Eigen
***********************************
Explanation before starting
***************************
Eigen consists only of header files, hence there is nothing to compile
before you can use it. Moreover, these header files do not depend on your
platform, they are the same for everybody.
Method 1. Installing without using CMake
****************************************
You can use right away the headers in the Eigen/ subdirectory. In order
to install, just copy this Eigen/ subdirectory to your favorite location.
If you also want the unsupported features, copy the unsupported/
subdirectory too.
Method 2. Installing using CMake
********************************
Let's call this directory 'source_dir' (where this INSTALL file is).
Before starting, create another directory which we will call 'build_dir'.
Do:
cd build_dir
cmake source_dir
make install
The "make install" step may require administrator privileges.
You can adjust the installation destination (the "prefix")
by passing the -DCMAKE_INSTALL_PREFIX=myprefix option to cmake, as is
explained in the message that cmake prints at the end.
答案1
我不熟悉 Eigen,但从错误消息来看,它似乎需要“源外”构建。
这意味着如果你已经下载并解压了 Eigen 到 /home/brentonhorne/eigen-eigen-5097c01bcdc4,那么你应该创建一个新的目录外部整个 Eigen 根目录,例如 /home/brentonhorne/build_eigen 并从那里运行 CMake。我猜是这样的:
mkdir /home/brentonhorne/build_eigen
cd /home/brentonhorne/build_eigen
cmake /home/brentonhorne/eigen-eigen-5097c01bcdc4
make
sudo make install
答案2
需要注意的是,Eigen 库可以作为一个包进行安装。
sudo apt-get install libeigen3-dev
对于最新的库和sudo apt-get install libeigen2-dev
对于这个问题中提到的库。
答案3
好吧,我自己安装了它,它运行得很好。以下是我所做的(与我之前发布的相同):
Eigen 3.1.2
从下载http://eigen.tuxfamily.org/index.php?title=Main_Page
。- 打开终端(++ Ctrl)并运行:AltT
cd ~/下载 tar xzf eigen-eigen-5097c01bcdc4.tar.bz2 cd eigen-eigen-5097c01bcdc4 sudo cp -r Eigen /usr/include/
- 完毕!
- 将
Eigen
目录复制到/usr/include
。
您需要 root 用户权限才能执行此操作。因此,打开终端,浏览到包含 Eigen 目录的目录,然后运行sudo cp -r Eigen /usr/include/
。
- 要包含目录下的头文件,请
Dense
使用Eigen
#包括<特征/密集>