Where does gcc look for C and C++ header files?

Bill the Lizard picture Bill the Lizard · Dec 5, 2008 · Viewed 115.4k times · Source

On a Unix system, where does gcc look for header files?

I spent a little time this morning looking for some system header files, so I thought this would be good information to have here.

Answer

Drew Dormann picture Drew Dormann · Dec 5, 2008
`gcc -print-prog-name=cc1plus` -v

This command asks gcc which C++ preprocessor it is using, and then asks that preprocessor where it looks for includes.

You will get a reliable answer for your specific setup.

Likewise, for the C preprocessor:

`gcc -print-prog-name=cpp` -v