I'd like gcc to include files from $HOME/include
in addition to the usual include directories, but there doesn't seem to be an analogue to $LD_LIBRARY_PATH
.
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.
just a note:
CPLUS_INCLUDE_PATH
andC_INCLUDE_PATH
are not the equivalent ofLD_LIBRARY_PATH
.LD_LIBRARY_PATH
serves theld
(the dynamic linker at runtime) whereas the equivalent of the former two that serves your C/C++ compiler with the location of libraries isLIBRARY_PATH
.Create an alias for gcc with your favorite includes.
A gcc spec file can do the job, however all users on the machine will be affected.
See here
Try setting
C_INCLUDE_PATH
(for C header files) orCPLUS_INCLUDE_PATH
(for C++ header files).As Ciro mentioned,
CPATH
will set the path for both C and C++.More details here.
Here is link to GCC 4.8.1 manual where C_INCLUDE_PATH and CPLUS_INCLUDE_PATH environment variables are documented.