Makefile cannot find load libraries installed in macports

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

.

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

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

This 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 src / graph.h file, where it looks for boost / graph / adjacency_list.hpp, the include statement is here:
  #include<boost/graph/adjacency_list.hpp>

How do I make this work?

+2


a source to share


2 answers


You need to tell the compiler the base directory Boost is in. You can do this with the compiler command line option -I

:



g++ -I/opt/local/include ...

      

+13


a source


Add one of these paths to your include path.

You can enable the version using the following command:

#include <boost/version.hpp>

      



which defines:

#define BOOST_VERSION 104200
#define BOOST_LIB_VERSION "1_42"

      

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

+2


a source







All Articles