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.
I'm a fan of Open Source and have a growing interest in serverless and edge computing. I'm not a big fan of spiders, but they're doing good work eating bugs. I also stream on Twitch.
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!