Search code examples
gccinclude

CPLUS_INCLUDE_PATH doesn't works


I have set my environment variable CPLUS_INCLUDE_PATH to boost.

>echo $CPLUS_INCLUDE_PATH
boost

But it doesn't work at all.

>g++ parse_utils.cpp
parse_utils.cpp:1:34: fatal error: boost/lexical_cast.hpp: No such file or directory

The .hpp is in that path.

>g++ parse_utils.cpp -Iboost 
(work well)

I thought CPLUS_INCLUDE_PATH is equivalent to -I option?

>g++ --version
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

Solution

  • You need to export the variable before running g++:

    export CPLUS_INCLUDE_PATH