delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/11/12:30:30

Date: Tue, 11 Feb 1997 19:21:04 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Matthias Baas <un1t AT rz DOT uni-karlsruhe DOT de>
cc: djgpp AT delorie DOT com
Subject: Re: typeinfo.h and math.h conflict
In-Reply-To: <5dp7r4$gui$1@nz12.rz.uni-karlsruhe.de>
Message-ID: <Pine.SUN.3.91.970211191341.5506F-100000@is>
MIME-Version: 1.0

On Tue, 11 Feb 1997, Matthias Baas wrote:

> g:/lang/cxx/std/stdexcep.h:58: previous declaration of `struct
> exception & exception::operator =(const struct exception &)' with C++
> linkage
> g:/include/math.h:79: conflicts with new declaration with C linkage
> g:/include/math.h:79: confused by earlier errors, bailing out
> 
> So why is there a class named "exception" in math.h and how can I
> use math.h and exception handling together in my programs?

With all due respect, it helps to actually look inside math.h instead of
expecting others to do that for you.  No offence.  Really.

Here's the scoop: math.h doesn't declare a class named ``exception'' (of 
course), it defines a ``struct exception''.  I don't know whether this is 
just an incompatibility between GCC 2.7.2.1 and libg++ 2.7.1 (anybody?), 
but as far as I could see, if you compile your source with -posix, the 
problem will go away.  (However, I didn't actually try this, so I might 
be mistaken.)

As for the real solution, is there somebody on this group who knows about 
namespaces in the current C++ draft standard and can suggest a 
solution?  One possibility is obviously to rename that struct, but that 
could break existing software.  Anybody?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019