1 apt方式:
sudo apt install libeigen3-dev
sudo cp -r /usr/local/include/eigen3/Eigen /usr/local/include
2 源码安装:
地址:http://eigen.tuxfamily.org/index.php?title=Main_Page
版本3.4.0地址:https://gitlab.com/libeigen/eigen/-/releases/3.4.0
(1)安装
cd eigen3文件夹
mkdir build
cd build
cmake ..
sudo make install
头文件默认安装在:/usr/local/include/eigen3/
(2)cp
sudo cp -r /usr/local/include/eigen3/Eigen /usr/local/include
(3)测试
test.cpp
#include
#include
using namespace Eigen;
using namespace Eigen::internal;
using namespace Eigen::Architecture;
using namespace std;
int main()
{
RowVectorXd vec1(3);
vec1<< 1,2,3;
cout << "vec1=\n" << vec1 << endl;
return 0;
}
g++ test.cpp -o test
./test
结果如下即可。
vec1=
1 2 3
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)