Method 2
In a terminal/console with a Unix shell (such as csh, tsh, bash, and so on), do the following:
- Create a simple program – for example,
hello.c. - Add the header file you want to find, and save it.
- In a bash command shell, execute the following:
cc -H hello.c 2>&1 | grep '^\.\ '
This command, which looks like a lot of gobbledegook, is doing the following:
- It invokes the compiler with the
-Hoption. The list of header files is sent tostderr. 2>&1redirects stderr tostdout.- stdout is then redirected via a pipe (
|) togrep, a regular expression parser. - grep is told to search the beginning of each line for
<period><space>:'…'is the search string.^indicates the beginning of a line.\.is a period (this is important, as a dot (.) alone has special meaning in grep).\is a space (this is important, as a space alone has special meaning in grep).
- You will now only see one or two...