* Directories for gcc
@ 2001-12-12 22:41 Yong Mao
2001-12-13 0:37 ` Rupert Wood
0 siblings, 1 reply; 4+ messages in thread
From: Yong Mao @ 2001-12-12 22:41 UTC (permalink / raw)
To: 'gcc-help@gcc.gnu.org'
Hi all,
I'm new to using gcc on Linux. Now I have got a question. I know that we can
use -I option to indicate the include directory so that the compiler can
find my own .h files. I know I don't have to specify the include directories
for some system .h files ( stdio.h for instance, is put under /usr/include
and gcc will go to search that directory ) . My question is how the
compiler decides the search directories for the system include files. Is
this configurable somewhere or built into the binary of the gcc?
A similar case is the man command which will look up the /etc/man.config
file to decide the directories for the man pages search and therefore I can
control the search directories by writing the content of the /etc/man.config
file.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Directories for gcc
2001-12-12 22:41 Directories for gcc Yong Mao
@ 2001-12-13 0:37 ` Rupert Wood
2001-12-14 1:14 ` Axel Kittenberger
0 siblings, 1 reply; 4+ messages in thread
From: Rupert Wood @ 2001-12-13 0:37 UTC (permalink / raw)
To: 'Yong Mao'; +Cc: gcc-help
Yong Mao wrote:
> I know that we can use -I option to indicate the include directory
> so that the compiler can find my own .h files. I know I don't have
> to specify the include directories for some system .h files
> ( stdio.h for instance, is put under /usr/include and gcc will go
> to search that directory ) . My question is how the compiler decides
> the search directories for the system include files. Is
> this configurable somewhere or built into the binary of the gcc?
Both, really.
A default set of directories is compiled in: look at gcc/protoize.c in
the source. You can see these from a binary gcc by compiling or
preprocessing any source with the '-v' switch.
You can also always add more directories on the command line using '-I'
or '-isystem'. You can probably also edit them into the compiler specs
file (<prefix>/lib/gcc-lib/<host>/version/specs) but I don't know much
about specs files. If you need more directories for a configure/make
source tree then you set -I switches in the CC or CFLAGS environments,
e.g. (bash)
export CC="gcc -I/space/home/rmw/local/include"
or
export CFLAGS="-O2 -g -I/space/home/rmw/local/include"
Hope that helps,
Rup.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Directories for gcc
2001-12-13 0:37 ` Rupert Wood
@ 2001-12-14 1:14 ` Axel Kittenberger
0 siblings, 0 replies; 4+ messages in thread
From: Axel Kittenberger @ 2001-12-14 1:14 UTC (permalink / raw)
To: 'Yong Mao'; +Cc: gcc-help
> A default set of directories is compiled in: look at gcc/protoize.c in
> the source. You can see these from a binary gcc by compiling or
> preprocessing any source with the '-v' switch.
>
> You can also always add more directories on the command line using '-I'
> or '-isystem'. You can probably also edit them into the compiler specs
> file (<prefix>/lib/gcc-lib/<host>/version/specs) but I don't know much
> about specs files. If you need more directories for a configure/make
> source tree then you set -I switches in the CC or CFLAGS environments,
> e.g. (bash)
Might be worth a mention additionally if you don't want it to look in
/usr/include for headers specify the command parameter:
--nostdinc
- Axel
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Directories for gcc
@ 2001-12-13 16:22 Yong Mao
0 siblings, 0 replies; 4+ messages in thread
From: Yong Mao @ 2001-12-13 16:22 UTC (permalink / raw)
To: 'Rupert Wood'; +Cc: gcc-help
Hi,
Thanks for the information. So the conclusion is that the standard search
directories for GCC have been hard-coded into the binary and you can only
add your own directories to it by some option or environment variables
setting.
Have a good day.
-----Original Message-----
From: Rupert Wood [mailto:me@rupey.net]
Sent: Thursday, December 13, 2001 4:38 PM
To: 'Yong Mao'
Cc: gcc-help@gcc.gnu.org
Subject: RE: Directories for gcc
Yong Mao wrote:
> I know that we can use -I option to indicate the include directory
> so that the compiler can find my own .h files. I know I don't have
> to specify the include directories for some system .h files
> ( stdio.h for instance, is put under /usr/include and gcc will go
> to search that directory ) . My question is how the compiler decides
> the search directories for the system include files. Is
> this configurable somewhere or built into the binary of the gcc?
Both, really.
A default set of directories is compiled in: look at gcc/protoize.c in
the source. You can see these from a binary gcc by compiling or
preprocessing any source with the '-v' switch.
You can also always add more directories on the command line using '-I'
or '-isystem'. You can probably also edit them into the compiler specs
file (<prefix>/lib/gcc-lib/<host>/version/specs) but I don't know much
about specs files. If you need more directories for a configure/make
source tree then you set -I switches in the CC or CFLAGS environments,
e.g. (bash)
export CC="gcc -I/space/home/rmw/local/include"
or
export CFLAGS="-O2 -g -I/space/home/rmw/local/include"
Hope that helps,
Rup.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-12-14 9:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-12 22:41 Directories for gcc Yong Mao
2001-12-13 0:37 ` Rupert Wood
2001-12-14 1:14 ` Axel Kittenberger
2001-12-13 16:22 Yong Mao
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).