views:

288

answers:

2

I just installed boost 1.42.0 from macports using sudo port install boost.

Everything worked fine. Now I have a project that I'm trying to build using a makefile. Everything builds fine until it comes to the file that needs the boost library.

It says:
src/graph.h:20:42: error: boost/graph/adjacency_list.hpp: No such file or directory

That file is actually located in two places:
/opt/local/include/boost/graph/adjacency_list.hpp
and
/opt/local/var/macports/software/boost/1.42.0_0/opt/local/include/boost/graph/adjacency_list.hpp

In the file src/graph.h where it's looking for boost/graph/adjacency_list.hpp, the include statement is here:
#include<boost/graph/adjacency_list.hpp>

How do I make this work?

+1  A: 

Add one of these paths to your include path.

You can include the version using this include:

#include <boost/version.hpp>

which defines:

#define BOOST_VERSION 104200
#define BOOST_LIB_VERSION "1_42"

Use this to verify if your compiler is using the version you want it to use.

Eddy Pronk
+3  A: 

You need to tell the compiler the base directory where Boost is intalled. You can do that with the compilers -I command line option:

g++ -I/opt/local/include ...
R Samuel Klatchko
Is there no way I can have all future projects that use boost automatically search for /boost in that path? Do I have to do it every project?
pinnacler
It worked, but I'm still curious. P.S. For anybody that wants to know how to build SLAM6D on a mac: Open makefile.options (after being renamed from makefile.options.macosx) and add this line at the bottom with the other CFLAGSCFLAGS += -I/opt/local/include
pinnacler
@pinnacler - you could do `ln -s /opt/local/include/boost /usr/include`
R Samuel Klatchko