You can get just the configuration with a plain gcc -v, but by invoking the preprocessor with -E and pointing it at some nonsense /dev/null, you additionally get to inspect the paths it will use for looking up libraries. Because you passed in something nonsensical, it can't determine what sort of compilation you're doing, so you have to explicitly specify with -x c. This forces it to attempt to preprocess the input as a C program which provides the most complete set of information. Works with clang too.
Cute trick to inspect your C compiler configuration:
You can get just the configuration with a plain
gcc -v
, but by invoking the preprocessor with-E
and pointing it at some nonsense/dev/null
, you additionally get to inspect the paths it will use for looking up libraries. Because you passed in something nonsensical, it can't determine what sort of compilation you're doing, so you have to explicitly specify with-x c
. This forces it to attempt to preprocess the input as a C program which provides the most complete set of information. Works withclang
too.Handy!
Awesome!