如何将库添加到Eclipse CDT? (无此文件或目录) [英] How do you add libraries to Eclipse CDT? (No such file or directory)

查看:121
本文介绍了如何将库添加到Eclipse CDT? (无此文件或目录)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

添加标头库时遇到一些问题。



我右键单击项目,然后单击属性-> C / C ++常规->路径和符号



包含标签中:语言-> GNU C ++



我单击在添加...->文件系统上,然后添加名为boost_1_52_0的文件夹或任何其他文件夹。



当我使用Eclipse的intellisense时,它会找到我想要的,但是构建失败。

 致命错误:boost / random / ...:无此类文件或目录

不确定为什么会这样。



任何刚起步的帮助将不胜感激。

  22:34:02 ****增量构建配置项目TestProj ****的默认值
使所有
g ++ -O2 -g -Wall -fmessage-length = 0 -c -o TestProj.o TestProj.cpp
TestProj.cpp: 5:52:致命错误:boost / random / random_number_generator.hpp:没有这样的文件或目录
< ; builtin> ;:目标 TestProj.o的配方失败
编译终止。
make:*** [TestProj.o]错误1

显然不是就像将文件夹添加到eclipse提供的接口的目录一样容易。我很敬畏。



致谢,
Dane

解决方案

< blockquote>

我右键单击我的项目,然后单击Properties-> C / C ++ General-> Paths and Symbols。



在 Includes选项卡中:语言-> GNU C ++



我单击添加...->文件系统,然后添加文件夹名为boost_1_52_0或任何其他文件夹。



当我使用Eclipse的intellisense时,它会找到所需的内容,但是构建失败。


是的,这就是使Eclipse CDT intellisense和索引器与外部引用保持同步的必要条件。

 致命错误:boost / random / ...:没有这样的文件或目录




不知道为什么会这样。


这是因为您对构建项目可能会选择您要管理构建p自己动手:



如果是这样,则必须让您手动管理的 makefile 了解环境和编译器/链接器标志设置。



在这种情况下,通过Eclipse CDT build属性与手动管理的makefile通信的一种方式是使用提及的项目属性部分的构建变量环境设置:


I'm having some issues adding header libraries.

I right click on my project, and click Properties-> C/C++ General-> Paths and Symbols.

In the Includes tab: Languages-> GNU C++

I click on Add... -> File system then add the folder called boost_1_52_0, or any other folder.

When I use Eclipse's intellisense, it finds the that I desire, however it fails on building.

fatal error: boost/random/...: No such file or directory

Not sure why this is happening.

Any help just getting off the ground would be appreciated.

22:34:02 **** Incremental Build of configuration Default for project TestProj****
make all 
g++ -O2 -g -Wall -fmessage-length=0    -c -o TestProj.o TestProj.cpp
TestProj.cpp:5:52: fatal error: boost/random/random_number_generator.hpp: No such file     or directory
<builtin>: recipe for target `TestProj.o' failed
compilation terminated.
make: *** [TestProj.o] Error 1

Apparently it isn't as easy as adding a folder to the directory to the interfaces eclipse provides. I am in awe.

Regards, Dane

解决方案

I right click on my project, and click Properties-> C/C++ General-> Paths and Symbols.

In the Includes tab: Languages-> GNU C++

I click on Add... -> File system then add the folder called boost_1_52_0, or any other folder.

When I use Eclipse's intellisense, it finds the that I desire, however it fails on building.

Yes, that's what you might need to keep Eclipse CDT intellisense and the indexer in sync with your external references.

fatal error: boost/random/...: No such file or directory

Not sure why this is happening.

This is because your settings for how to build the project might choose you're going to manage the build process yourself:

If so, you have to let know your manually managed makefile know about the environment and compiler/linker flag settings.

A way to communicate with the manually managed makefile with the Eclipse CDT build properties for such cases, is to use e.g. Build Variables or Environment settings from the mentioned project property section:

这篇关于如何将库添加到Eclipse CDT? (无此文件或目录)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆