I just finished installing Boost on OSX Mountain Lion, and I got this dialog…
The following directory should be added to compiler include paths:
/usr/local/boost_1_51_0The following directory should be added to linker library paths:
/usr/local/boost_1_51_0/stage/lib
The Boost “Getting Started” page suggest this program:
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " " );
}
Compiled with this script:
c++ -I /usr/local/boost_1_51_0 example.cpp -o example
Is there a way to add this include path in Linux/UNIX for Mac, so I don’t have to always type the path when I’m compiling?
Short answer: Yes.
Long answer: You shouldn’t do it.
Reason: If you add specific compiler flags to be used at all times, no matter what you are compiling, you will end up with situations where the wrong thing is included or linked against.
It is always a good thing to explicitly state the flags to be used in a makefile or on the command line and there are tools like
pkg-configthat can make this less troublesome and error prone.