Saya mencoba menginstal eigen , tetapi sepertinya tidak berhasil.
Aku melakukannya:
sudo apt-get install libeigen3-dev
dan semuanya tampak baik-baik saja
dpkg -p libeigen3-dev
Saya mendapat:
Package: libeigen3-dev
Priority: extra
Section: libdevel
Installed-Size: 3718
Maintainer: Ubuntu Developers <[email protected]>
Architecture: all
Source: eigen3
Version: 3.2.0-4
Depends: pkg-config
Suggests: libeigen3-doc
Size: 698062
Description: lightweight C++ template library for linear algebra
Eigen 3 is a lightweight C++ template library for vector and matrix math,
a.k.a. linear algebra.
.
Unlike most other linear algebra libraries, Eigen 3 focuses on the simple
mathematical needs of applications: games and other OpenGL apps, spreadsheets
and other office apps, etc. Eigen 3 is dedicated to providing optimal speed
with GCC. A lot of improvements since 2-nd version of Eigen.
Original-Maintainer: Debian Science Maintainers <[email protected]>
Homepage: http://eigen.tuxfamily.org
Segalanya tampak baik bagi saya. Namun, ketika saya mencoba mengkompilasi kode dasar (diberikan dalam tutorial):
first_eigen.cpp
#include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d a;
a << 1, 2,
3, 4;
MatrixXd b(2,2);
b << 2, 3,
1, 4;
std::cout << "a + b =\n" << a + b << std::endl;
std::cout << "a - b =\n" << a - b << std::endl;
std::cout << "Doing a += b;" << std::endl;
a += b;
std::cout << "Now a =\n" << a << std::endl;
Vector3d v(1,2,3);
Vector3d w(1,0,0);
std::cout << "-v + w - v =\n" << -v + w - v << std::endl;
}
Saya menjalankannya di shell seperti ini:
g++ -std=c++11 first_eigen.cpp -o my_exec
Saya mendapatkan kesalahan berikut:
first_eigen.cpp:2:23: fatal error: Eigen/Dense: No such file or directory
#include <Eigen/Dense>
^
compilation terminated.
Jadi sepertinya eigen
tidak diinstal. Apa yang saya lewatkan?
sudo ln -s /usr/include/eigen3/Eigen /usr/local/include/Eigen
Ubah sertakan ke
sumber
Pls. lihat apakah Anda memiliki folder bernama "Eigen" di / usr / include.
Saya tidak tahu eigen dan rutin instalasi. Tetapi seringkali dev menyertakan nama dengan sebuah versi.
Jika Anda memiliki folder "Eigen3" di direktori / usr / include Anda, Anda harus mengubah kode Anda menjadi:
sumber