title: Specifying include path to boost to one place only in g++
body: <p>I am working on a code base that uses the boost libraries.  But, I recently ran into problems building the base on a new user's machine.  I was able to boil the problem to the following.  Here's how the build system looks like:</p>
  
  <pre><code>/root
      /SubModules_with_Makefiles_and_Code
      /thirdparty/boost
  </code></pre>
  
  <p>The submodule code will reference boost stuff like so (for example):</p>
  
  <pre><code>#include &lt;boost/property_tree/ptree.hpp&gt;
  </code></pre>
  
  <p>And the sub module make files will build such a code like so (for example):</p>
  
  <pre><code>g++ -c -o code.o code.cpp -I/root/thirdparty/boost
  </code></pre>
  
  <p>Our 3rd party boost library is version 1.37.  However, some modules have begun using later versions of boost.  This problem has been masked because the machines where these modules have been built contain boost 1.41 installed in /usr/include/boost.</p>
  
  <p>The problem came to bear because the new user's machine did not have boost 1.41 installed in /usr/include.  Ideally, I would like g++ to look for boost in the third party directory and nowhere else.  This way, we can have tighter control of how the code base gets built.</p>
  
  <p>-I&lt;dir> places &lt;dir> before the system includes during lookup, but system includes are still looked at and that is where later versions of boost can be installed depending on the machine.  I can suppress looking at the system includes, but that would be a real pain.</p>
  
  <p>Is there anyway smart way to go about this, other than replacing:</p>
  
  <pre><code>#include &lt;boost/something.hpp&gt;
  </code></pre>
  
  <p>to</p>
  
  <pre><code>#include &lt;thirdparty/boost/something.hpp&gt;
  </code></pre>
  
  <p>?  If it helps, I am using gnu make 3.81 and g++ 4.4.5 on redhat linux.</p>