Tag Archives: include directory

Show default include directories of gcc and show default library search path of ld

To show the default include directories used when calling gcc you can manually invoke the preprocessor with -v option:
$ cpp -v
The output will contain something like:
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/include
/usr/local/include
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/include-fixed
/usr/include

To find out the used library search paths of ld (linker) just use:
$ ldconfig -v 2>/dev/null | grep -v ^$'\t'
If invoked as $ ldconfig -v the libraries in the used paths are printed out as well.

I found this quite helpfull as I had problems with unresolved includes.

sources: [1] and [2]