This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: Directories for gcc
- From: "Rupert Wood" <me at rupey dot net>
- To: "'Yong Mao'" <YMao at Optimight dot com>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: Thu, 13 Dec 2001 08:37:52 -0000
- 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.