libstdc++ headers and system headers

Alexandre Oliva
Fri Feb 16 11:15:00 GMT 2001

On Feb 16, 2001, Joe Buck <jbuck@synopsys.COM> wrote:

> Alexandre Oliva writes:
>> In fact, IMO, it's *wrong* to add system header directories with -I.
>> You should use -isystem for those.

> This statement will be seen as strange by anyone who must use more than
> one compiler.

A system header, by definition, is one that is searched by the
compiler by default.  You should never have to -I it, and it's always
been the case that -I/usr/include would just break GCC on many
platforms.  include/g++-v3 is no different.  

> -isystem is gcc-specific, while -I is mostly portable.

This is just because most other compilers don't offer any way for the
user to override their internal notions of what the system headers are
located.  GCC does.

> Now, if the only effect of using -I for system headers is, say, you don't
> get the pragma that disables warnings, that's probably OK.  But if more
> severe breakage occurs, it will probably be seen as a bug (sorry Robert,
> I used that word again!).

-I/usr/include will, for example, cause an inappropriate varargs.h to
be found by GCC.  And that's just the beginning.  Potentially, many
other things will break.  It's just wrong to use -I/usr/include; the
GCC manual has warned about this for ages, and contains a complete
explanation of the problem.

Alexandre Oliva   Enjoy Guarana', see
Red Hat GCC Developer                  aoliva@{,}
CS PhD student at IC-Unicamp        oliva@{,}
Free Software Evangelist    *Please* write to mailing lists, not to me

More information about the Libstdc++ mailing list