This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
'extern "C" { ...}' and 'ANSI C++ forbids ...'
- To: egcs at egcs dot cygnus dot com, egcs-bugs at egcs dot cygnus dot com
- Subject: 'extern "C" { ...}' and 'ANSI C++ forbids ...'
- From: Konstantin Baumann <kostab at math dot uni-muenster dot de>
- Date: Thu, 15 Jul 1999 13:33:03 +0200
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