'extern "C" { ...}' and 'ANSI C++ forbids ...'

Philipp Thomas kthomas@gwdg.de
Thu Jul 15 14:41:00 GMT 1999


On Thu, 15 Jul 1999 13:33:03 +0200, Konstantin Baumann
<kostab@math.uni-muenster.de> wrote:

>    /usr/openwin/include/X11/Xlib.h:2071: ANSI C++ forbids declaration
>                                          `XActivateScreenSaver' with no type

>I think this an error, because the <X11/Xlib.h>-header-file is included in
>"C"-mode not in "C++"-mode!

No, this is correct. 'extern C' only tells a compiler that name
mangling does't apply. In all other respects the code has to follow
the C++ standard.

>Is there a switch to turn this behavior off (or a workaround)?

If you don't want an error, use '-fpermissive', but AFAIK you'll still
get a warning. If you want to completely get rid of it correct the
header. BTW, C9X will also ban 'implicit int'
declarations/definitions.


Philipp

-- 
Close the windows! The penguin is freezing.


More information about the Gcc-patches mailing list