public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* What's the system include directory?
@ 2014-01-19 15:59 parmenides
  2014-01-20 20:15 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: parmenides @ 2014-01-19 15:59 UTC (permalink / raw)
  To: gcc-help

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

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

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?

2. Are system directories are equivalent to GCC's default include search
directories?

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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: What's the system include directory?
  2014-01-19 15:59 What's the system include directory? parmenides
@ 2014-01-20 20:15 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2014-01-20 20:15 UTC (permalink / raw)
  To: parmenides; +Cc: gcc-help

On Sun, Jan 19, 2014 at 7:59 AM, parmenides <mobile.parmenides@gmail.com> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-20 20:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-19 15:59 What's the system include directory? parmenides
2014-01-20 20:15 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).