Jesse Beder Jesse Beder - 1 year ago 170
Linux Question

How to add a default include path for gcc in linux?

I'd like gcc to include files from

in addition to the usual include directories, but there doesn't seem to be an analogue to
. I know I can just add the include directory at command line when compiling (or in the makefile), but I'd really like a universal approach here, as in the library case.

Answer Source

Try setting C_INCLUDE_PATH (for C header files) or CPLUS_INCLUDE_PATH (for C++ header files).

As Ciro mentioned, CPATH will set the path for both C and C++.

More details here.