Danedo Danedo - 1 month ago 9
C++ Question

How do you add libraries to Eclipse CDT? (No such file or directory)

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

Answer

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: CDT C/C++ Build Properties

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: enter image description here

Comments