I\'m having some issues adding header libraries.
I right click on my project, and click Properties-> C/C++ General-> Paths and Symbols.
In
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:
What to add depends on what you are trying to include. In the case of Boost, there are a number of header-only libraries, and there are some libraries that require linking in static/shared-object libraries (e.g., serialization).
For header-only libraries, you just need to include the base directory of all the header files. With gcc
, you add the directory using the -I
flag (e.g., -I C:/path/to/boost_52_0
). With a managed makefile project in Eclipse, you can accomplish the same using Properties > C/C++ Build > Settings > Tool Settings > GCC C++ Compiler > Directories
For static/shared-object libraries, you have to specify two options:
-l
--> The name of the library, less the 'lib' prefix and the file suffix (e.g., libboost_serialization.dll
-> boost_serialization
-L
--> The directory to look for the library file in. This is only needed if the library is on a non-standard path.As @Chris pointed out, for a managed makefile project, both of these options can be set through Properties > C/C++ Build > Settings > Tool Settings > GCC C++ Linker > Libraries
Is Properties > C/C++ Build > Settings > Tool settings > ... Linker > Libraries
what do you search? It's where you add the -l options when compiling from command line.
I had the same problem. Changing settings in C/C++ Build
--> Settings
solved the problem. Ensure that the ".lib" filename extension is excluded! See the screenshot below:
Solved by adding -I to makefile.
BOOST = C:/Users/neo/Documents/boost_1_52
CXXFLAGS = -O2 -g -Wall -fmessage-length=0 -I$(BOOST)
OBJS = p1.o
LIBS =
TARGET = p1.exe
$(TARGET): $(OBJS)
$(CXX) -o $(TARGET) $(OBJS) $(LIBS)
all: $(TARGET)
clean:
rm -f $(OBJS) $(TARGET)