Directories for gcc
Rupert Wood
me@rupey.net
Thu Dec 13 00:37:00 GMT 2001
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