如何在Eclipse C ++中使用“使用namepace Eigen”?

时间:2019-05-26 09:35:03

标签: c++ eclipse eigen

我已将Eigen库包含在我的Eclipse C ++项目中,并且该程序已接受该库,但是当我尝试使用using namespace Eigen;时(与处理Eigen一样,错误符号#include <stdio.h> #include <math.h> #include <stdlib.h> #include <iostream> #include <vector> #include <string> #include <Eigen/Dense> #include <Eigen/QR> using namespace std; using namespace Eigen; //Here comes the error 无法解析

我已经包含了Eigen库,但是无论如何我都无法使用其命名空间

sum
  

描述资源路径位置类型   无法解析符号“本征” TFG.cpp / TFG第19行语义错误

这是我的错误。有人有解决方案吗?非常感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

什么都没用。我只是从头开始。我有Eclipse C ++,MinGW正在运行。我从其网站上下载了Eigen,并将其解压缩到我的桌面上名为Eigen的文件夹中。现在我去了Project-> Properties-> C / C ++ General->路径和符号-> Includes->添加->文件系统-> C:... \ Desktop \ Eigen \ Eigen \ src \ Core。我在“库路径”中也是如此。然后,我进入程序并编写#include <Matrix.h>。我建立了项目,一切正常,没有错误。但是当我尝试使用此类时,例如

Eigen::VectorXd v(10);
v[0] = 0.1;
v[1] = 0.2;
v(0) = 0.3;
v(1) = 0.4;

它给我一个错误:

无法解析'Eigen :: VectorXd'TFG.cpp / TFG第58行语义错误

我该怎么办??非常感谢您的耐心