Where are the c header files on my system?

Michael ODonnell michael.odonnell at comcast.net
Tue May 19 10:01:19 EDT 2009



There are several ways to get GCC to supply the info in question along
with a blizzard of other stuff:

 - Ask it to be generally verbose by adding the '-v' flag to the command line.

      Maybe not enough info for your purposes but often useful
      nevertheless.

 - Ask it to mention each header file on the fly with '-H'.

      Probably what you're looking for.

 - Ask it to spew the preprocessed source code (with all preprocessor
   directives including the locations of all #included files) with -E.

      This one can often provide insight into mysterious or bizarre
      compilation puzzles when other approaches fail, but be prepared
      for large volumes of, um, stuff.  I often crunch the resultant
      output further with a little script, thus:

#!/bin/bash
#
# A pipe that tidies up the output of a cc -E run a little bit...
#
sed -e 's/[[:space:]]*$//' -e '/^[[:space:]]*#/ { s_^_/* _ ; s_$_ */_ }' | cat -s



More information about the gnhlug-discuss mailing list