Sunday, 15 June 2014

c++ - Specifying include path to boost to one place only in g++ -



c++ - Specifying include path to boost to one place only in g++ -

i working on code base of operations uses boost libraries. but, ran problems building base of operations on new user's machine. able boil problem following. here's how build scheme looks like:

/root /submodules_with_makefiles_and_code /thirdparty/boost

the submodule code reference boost stuff (for example):

#include <boost/property_tree/ptree.hpp>

and sub module create files build such code (for example):

g++ -c -o code.o code.cpp -i/root/thirdparty/boost

our 3rd party boost library version 1.37. however, modules have begun using later versions of boost. problem has been masked because machines these modules have been built contain boost 1.41 installed in /usr/include/boost.

the problem came bear because new user's machine did not have boost 1.41 installed in /usr/include. ideally, g++ boost in 3rd party directory , else. way, can have tighter command of how code base of operations gets built.

-i<dir> places <dir> before scheme includes during lookup, scheme includes still looked @ , later versions of boost can installed depending on machine. can suppress looking @ scheme includes, real pain.

is there anyway smart way go this, other replacing:

#include <boost/something.hpp>

to

#include <thirdparty/boost/something.hpp>

? if helps, using gnu create 3.81 , g++ 4.4.5 on redhat linux.

look @ 'include path' command line alternative (-i). can set searches included files. documentation here

c++ makefile g++ include-path

No comments:

Post a Comment