When I create my own non-standard path for library files (say, ~/lib) I can run ldconfig -n ~/lib and this directory is added to the list of locations ld uses to search for non-standard libraries.
Is there a similar switch for GCC/G++ (or an appropriate gcc/++ config manager) related to include directories, and if so, what? I’m aware the -I flag will include non-standard directories, butI’d rather not have to go through all my projects and have to add all forms of magic to the makefiles to make them work — and then find that these changes are (of course) non-portable to any other system this code is built on (with collaborators, etc), so editing the makefile isn’t really an option….
Edit: Note that my ignorance assumes this solution is gcc/++ only. I’m happy for any solution, however, so if there’s a method that abuses some property of ldconfig or whatever, I’m not adverse to it!
Generally, just do
man gcc. You’ll need-L <path>flag if you are willing to change the Makefiles. There’s also a solution similar toldconfig– to useLIBRARY_PATHenv. variable.Similarly, there’s
CPLUS_INCLUDE_PATHandC_INCLUDE_PATHandCPATHwhich are declaring a list of directories to search for header files.