I'm trying to programmatically find the
path on Linux, which as I understand it, in practice means finding what GCC considers it to be. (Is that quite true? How does Clang do it?)
According to http://gcc.gnu.org/onlinedocs/cpp/Search-Path.html
some of the components involve the CPU architecture and the GCC version; the latter in particular seems tricky; I suppose it could be obtained by running
and parsing the output (or
), but this seems inelegant at best and fragile at worst. Doing it from within one's code assuming one's program is being compiled with GCC might be another option, but it would require depending on that assumption.
What's the recommended way to do it?