On Sun, Jan 19, 2014 at 7:59 AM, parmenides <mobile.parmenides@xxxxxxxxx> wrote: > > I am reading GCC's manual, and feel uncertain about the concept of > system headers. > > 1. What are system headers? > > According to CPP's manual, > > "The header files declaring interfaces to the operating system and > runtime libraries often cannot be written in strictly conforming C." > > For Linux, the headers of Linux are located at > > /usr/include/linux > > The headers of runtime libraries are located at > > /usr/include # for C library > > and > > /usr/lib/gcc/target/version/include # for gcc's library When the CPP manual refers to the system headers, it means the ones in /usr/include (and all its subdirectories, including /usr/include/linux). The header files under /usr/lib/gcc are under the control of GCC and are not normally considered system header files (though in some cases some of them are edited copies of the system header files). > According to gcc's installation manual, pertaining to > --with-local-prefix configuation option, > > "Both the local-prefix include directory and the GCC-prefix include > directory are part of GCC's “system include” directories. " > > Thus, the local headers are located at > > /usr/local/include By default, yes. > Does the above statements are correct? One more question, what is the > local headers? It seems that headers from other softwares are considered > as local headers, right? what kind of softwares' headers are to be > installed in /usr/local/include? Putting header files in /usr/local/include is an approach that I rarely see today. It was used more in the past when more people built packages from source, and installed them in /usr/local so as not to disturb the system files. These days people tend to install binary packages, and the package manager can easily detect conflicts between those packages and any system packages. > 2. Are system directories are equivalent to GCC's default include search > directories? No, they are just the ones that are part of the system as opposed to being part of the GCC installation. > According to CPP's manual, > > "GCC looks in several different places for headers. On a normal Unix > system, if you do not instruct it otherwise, it will look for headers > requested with #include <file> in: > > /usr/local/include > libdir/gcc/target/version/include > /usr/target/include > /usr/include > " > > For bracket include statement, GCC is to search the above four > directories by default. Are these four are system directories? Are there > any other directories count as? Run gcc -v to see the full list of directories. Ian