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

前端 未结 9 1780
悲&欢浪女
悲&欢浪女 2020-11-28 17:26

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 info

9条回答
  •  野性不改
    2020-11-28 18:01

    The set of paths where the compiler looks for the header files can be checked by the command:-

    cpp -v

    If you declare #include "" , the compiler first searches in current directory of source file and if not found, continues to search in the above retrieved directories.

    If you declare #include <> , the compiler searches directly in those directories obtained from the above command.

    Source:- http://commandlinefanatic.com/cgi-bin/showarticle.cgi?article=art026

提交回复
热议问题