安裝及配置
關於VS2015無法打開Eigen/Dense的錯誤
Solution:
1、下載Eigen,並解壓。
1)CSDN:http://download.csdn.net/download/airaybaiju/10237226
2)官網:http://eigen.tuxfamily.org/index.php?title=Main_Page#Download
2、解壓之後的文件夾,重命名爲 eigen3 。
3、在項目屬性-> 配置屬性-> vc++目錄-> 包含目錄,
比如我的eigen3在F:\Eigen install pack\eigen3,包含目錄就是:F:\Eigen install pack\eigen3;
測試
- 我的工程文件位置:E:\VStestlibrary\test_eigen
- 我的庫安裝路徑:F:\eigen3(目前版本3.3.7)
- 我的屬性表位置:E:\prop(名字:eigen3.props,這個庫好像不分debug,release,64,32位,超級簡單!)
測試程序:
#include <iostream>
#include <Eigen\Dense>
using namespace std;
using namespace Eigen;
void main()
{
Matrix2d a;
a << 1, 2,
3, 4;
MatrixXd b(2, 2);
b << 2, 3,
1, 4;
cout << "a + b =\n" << a + b << endl;
cout << "a - b =\n" << a - b << endl;
cout << "Doing a += b;" << endl;
a += b;
cout << "Now a =\n" << a << endl;
cout << "a^T= " << a.transpose() << endl;
cout << "a*b= " << a*b << endl;
Vector3d v(1, 2, 3);
Vector3d w(1, 0, 0);
cout << "-v + w - v =\n" << -v + w - v << endl;
cout << v << endl;
cout << v.transpose() << endl;
system("pause");
}
結果: