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.
Expand C/C++ General and select Paths and Symbols. Click here to see an illustration (displayed in a separate window). Click Add to define new element (Include Path, Symbol, Library path etc). Click Edit to change selected element (Include Path, Symbol, Library path etc).
You need to use the which command to locate c compiler binary called gcc. Usually, it is installed in /usr/bin directory.
gcc -I adds include directory of header files.
includePath An include path is a folder that contains header files (such as #include "myHeaderFile. h" ) that are included in a source file. Specify a list of paths for the IntelliSense engine to use while searching for included header files.
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++ (and any other language).
More details in GCC's documentation.
Create an alias for gcc with your favorite includes.
alias mygcc='gcc -I /whatever/'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With