Include strangeness

Martin v. Loewis martin@mira.isdn.cs.tu-berlin.de
Fri Dec 31 20:54:00 GMT 1999


> Any suggestions would be welcomed as why this is happening - or the best 
> approach to tackle it.

Thanks for your bug report. This is not a bug in gcc. Instead, you are
defeating a work around a bug in the system headers.

The current g++ enforces a number of rules on C++ syntax and
semantics. In particular, declaring a function without return type is
illegal in C++, so C++ produces an error message.

Unfortunately, some of the system header files are not valid C++ (some
are not even valid C). In particular, the X header files on Solaris
are broken (this is a FAQ, see http://egcs.cygnus.com/faq.html#bugreport ).

To relax the strictness with regard to system headers, gcc does not
emit a number of error reports if the errors clearly occur in the
system headers. If you use -nostdinc, you expose these errors.

The best approach is not to use -nostdinc. The second-best approach is
to fix the header files. Next comes using -fpermissive; see the FAQ.

Hope this helps,
Martin

P.S. In any case, contact your operating system vendor and complain
about the bug in the system headers.



More information about the Gcc-bugs mailing list