c++cgccheader

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


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.


Solution

  • `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