eclipse 包括本征
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13593350/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Including Eigen
提问by ricksmt
I've included the Eigenheaders in a C++ project in Eclipse. When I try to build I get this error:
我已经在 Eclipse 的 C++ 项目中包含了Eigen头文件。当我尝试构建时,出现此错误:
Symbol 'Eigen' could not be resolved Semantic Error
From what I understand, this is a linker error, but Eigen is a header-only project and thus has no library to link against. The code that throws the error follows the basic tutorial they provide, and the offending snippet looks like this:
据我了解,这是一个链接器错误,但 Eigen 是一个只有头文件的项目,因此没有可链接的库。抛出错误的代码遵循他们提供的基本教程,有问题的代码片段如下所示:
#include <Eigen/Dense>
using namespace Eigen;
What am I doing wrong? If it helps, I'm running this on Linux. Thanks.
我究竟做错了什么?如果有帮助,我将在 Linux 上运行它。谢谢。
回答by greyfade
Eigen normally gets installed by most distributions to /usr/include/eigen2
and/or /usr/include/eigen3
or similar. Verify where the headers have been installed, as you need to add that path as an additional include path in your project.
Eigen 通常由大多数发行版安装到/usr/include/eigen2
和//usr/include/eigen3
或类似的。验证头文件的安装位置,因为您需要将该路径添加为项目中的附加包含路径。
回答by chill
Check the compiler gets the correct include path. For example, the Eigen library headers may be installed in /usr/include/eigen3
, so when compiling you'd have to give the compiler the flag -I /usr/include/eigen3
.
检查编译器获取正确的包含路径。例如,Eigen 库头文件可能安装在 中/usr/include/eigen3
,因此在编译时您必须为编译器提供标志-I /usr/include/eigen3
。
回答by ricksmt
I was fiddling around and found that telling the Indexer to index unused headers resolved my problem.
我正在摆弄,发现告诉索引器索引未使用的标题解决了我的问题。
Thanks for being on the ball guys. Kind of sorry I stumbled upon it myself.
谢谢你们的支持。有点抱歉我自己偶然发现了它。
回答by yar
You should not put the headers directly in your project, it makes eclipse horribly slow and sometimes even shows warnings or even (wrong) errors. Instead, you should put the library somewher on disk and link to it (set the propper include directory) via project propperties -> c/c++ General -> GNU C++ -> Add -> File system -> Eigens root folder (where you extracted it to)
您不应该将标题直接放在您的项目中,它会使 eclipse 非常缓慢,有时甚至会显示警告甚至(错误的)错误。相反,您应该将库放在磁盘上的某个位置并通过项目属性 -> c/c++ 常规 -> GNU C++ -> 添加 -> 文件系统 -> Eigens 根文件夹(您提取的位置)链接到它(设置适当的包含目录)它到)