How do I obtain the system include search paths of the C preprocessor? This is for a script that parses arbitrary source files and needs to know the full pathnames of the headers they #include
. Let's ignore for a moment that the user can alter this sequence of search paths with compiler flags. I'd prefer a solution that uses standard tools found on POSIX systems so my script depends on next to nothing.
I tried
cpp -v </dev/null |unusually_complex_filter
but this apparently doesn't take in account things like $C{,PLUS}_INCLUDE_PATH
. To know where vector
of #include<vector>
is in I suppose I must know the search paths in their precise order.