I am trying to include the following headers:
#include <libs/serialization/example/portable_binary_iarchive.hpp>
#include <libs/serialization/example/portable_binary_oarchive.hpp>
These files are located in a path like:
/home/nobody/boost_1_45_0/libs/serialization/example/portable_binary_iarchive.hpp
In my Makefile, I have added:
-I/home/nobody/boost_1_45_0/libs
However, when I compile, I get the error messages like:
error: libs/serialization/example/portable_binary_iarchive.hpp: No such file or directory
Can anybody tell me what I am doing wrong here? I am also including boost libraries like
#include <boost/archive/binary_oarchive.hpp>
However, to get those, it is sufficient to do in my Makefile:
-I/usr/include/boost
Why doesn't this work for the headers in the other location? How should I change my Makefile? The first statement current looks like this:
test: test.o
g++ -O3 -ffast-math -funroll-loops -ansi -pedantic-errors -L/usr/lib -lboost_filesystem -lboost_serialization -lboost_iostreams -lz -I/usr/include/boost -I/home/nobody/boost_1_45_0/libs -o test test.o
To get
#include <libs/serialization/example/portable_binary_iarchive.hpp>
from directory
/home/nobody/boost_1_45_0/libs/serialization/example/portable_binary_iarchive.hpp
your Makefile needs
-I/home/nobody/boost_1_45_0
Notice that I omitted the /libs
from the end. That's because your #include
directive already lists that directory.
As for your second example, is the file you want at this location:
/usr/include/boost/boost/archive/binary_oarchive.hpp
^^^^^ (repeated boost here)
If not g++ is likely defaulting to /usr/include
as the search space for
#include <boost/archive/binary_oarchive.hpp>
Ie., your
-I/usr/include/boost
is useless to the compiler.