加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 如何向Eclipse CDT添加库? (没有相应的文件和目录)

发布时间:2020-12-16 09:41:46 所属栏目:百科 来源:网络整理
导读:我在添加标头库时遇到了一些问题. 我右键单击我的项目,然后单击属性 – C/C++ General-路径和符号. 在“包含”标签中:语言 – GNU C. 我点击添加… – 然后文件系统添加名为boost_1_52_0的文件夹或任何其他文件夹. 当我使用Eclipse的intellisense时,它会找
我在添加标头库时遇到了一些问题.

我右键单击我的项目,然后单击属性 – > C/C++ General->路径和符号.

在“包含”标签中:语言 – > GNU C.

我点击添加… – >然后文件系统添加名为boost_1_52_0的文件夹或任何其他文件夹.

当我使用Eclipse的intellisense时,它会找到我想要的东西,但是它无法构建.

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

不知道为什么会这样.

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

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

显然,它并不像向eclipse提供的接口添加目录文件那么容易.我很敬畏.

问候,
戴恩

解决方法

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.

是的,这就是您可能需要保持Eclipse CDT intellisense和索引器与您的外部引用同步.

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

Not sure why this is happening.

这是因为您对如何构建项目的设置可能会选择您自己管理构建过程:

如果是这样,您必须知道您的手动管理的makefile知道环境和编译器/链接器标志设置.

对于这种情况,使用Eclipse CDT构建属性与手动管理的makefile进行通信的方法是使用例如从提到的项目属性部分构建变量或环境设置:

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读