[clug] discovering gcc "<xxx.h>" (system) include directories

steve jenkin sjenkin at canb.auug.org.au
Thu Nov 22 23:05:22 MST 2012

Carlo Hamalainen wrote on 23/11/12 4:32 PM:

> I suppose as a hack you could make a hello_world C file that just
> includes stdio.h, and then grep for stdio.h on "gcc -v -H helloworld.c",
> which will show you were that particular gcc binary is looking for
> files. But I may be barking up the wrong tree...

Good call. Thanks.

Wasn't aware of '-H' flag.
" -H  Print the name of each header file used, in addition to other
normal activities."

mini-too:linux- steve$ gcc -v -H t.c 2>&1|grep /inc

Configured with: ../gcc-4.3.6/configure --prefix=/opt/local


--> why didn't that show up before??

 --infodir=/opt/local/share/info --mandir=/opt/local/share/man
--datadir=/opt/local/share/gcc43 --with-local-prefix=/opt/local
--with-libiconv-prefix=/opt/local --with-system-zlib --disable-nls
--with-gmp=/opt/local --with-mpfr=/opt/local --enable-stage1-checking
--disable-multilib --with-as=/opt/local/bin/as
--with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar
--with-pkgversion='MacPorts gcc43 4.3.6_7'

ignoring nonexistent directory

==> another bad dir

. /usr/include/stdio.h
.. /usr/include/_types.h
... /usr/include/sys/_types.h
.... /usr/include/sys/cdefs.h
.... /usr/include/machine/_types.h
..... /usr/include/i386/_types.h
.. /usr/include/secure/_stdio.h
... /usr/include/secure/_common.h

==> that's quite a list of places it looked.

Steve Jenkin, Info Tech, Systems and Design Specialist.
0412 786 915 (+61 412 786 915)
PO Box 48, Kippax ACT 2615, AUSTRALIA

sjenkin at canb.auug.org.au http://members.tip.net.au/~sjenkin

More information about the linux mailing list