The #include
preprocessor directive in c++ is one of the first things that people learn. They come in two varieties:
#include<>
– usually meant for system-level includes such asiostream
or other headers from libraries installed at the system level.#include " "
– usually meant for files included from a location relative to the code being written… for instance, another header file for a class you just wrote.
But, where are system level headers stored? On Linux with the gcc tool chain installed, you can execute the following command to find out:
g++ -E -x c++ - -v < /dev/null
-E
– Stop after the pre-processing step-x c++
– language of interest is c++-v
– verbose output
In the output, look for the section that starts with #include <...> search starts here
. A collection of paths is listed after this line which is where the pre-processor will look for any includes that are in <...>
(angle brackets).
FWIW, there’s also a way to include additional paths to be used as system includes on the command line when compiling code.