This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


I am using egcs-19990714 on sparc-sun-solaris-2.6.

<X11/Xlib.h> contains some declarations like:

    extern XActivateScreenSaver(
    #if NeedFunctionPrototypes
        Display*		/* display */
    #endif
    );

I include <X11/Xlib.h> inside a C++ program like this:

    extern "C" {
    #include <X11/Xlib.h>
    };

But I get errors like the below one when compiling this program:

    /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!

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

-- 
Dipl.-Math. Konstantin Baumann                   Phone: +49-251-83-32701
Institute for Computer Science                     Fax: +49-251-83-33755
University of Muenster
Einsteinstrasse 62                    mailto:kostab@math.uni-muenster.de
D-48149 Muenster              http://wwwmath.uni-muenster.de/cs/u/kostab


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]