Directories for gcc
Yong Mao
YMao@Optimight.com
Thu Dec 13 16:22:00 GMT 2001
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.
More information about the Gcc-help
mailing list