Hi,
The error messages are pretty clear: First, leave 'virtual' off the
definition; keep it only on the declaration. (BTW, most of the time it
will be okay to include the empty definition within the class
definition.) Second, the exception specifications on both declaration
and definition must match.
Okay, objekt.h:
virtual ~ObjektFehler throw();
objekt.cc:
ObjektFehler::~ObjektFehler() throw() {};
produces
phlox@dario:~/sources/msw/objekte> gcc -c -o objekt.o objekt.cc
In file included from objekt.cc:1:
objekt.h:19: error: variable or field `ObjektFehler' declared void
objekt.h:19: error: `ObjektFehler' declared as a `virtual' field
objekt.h:19: error: parse error before `throw'
objekt.h:19: error: field `int ObjektFehler::ObjektFehler' with same name as
class
objekt.h:10: error: looser throw specifier for `virtual
ObjektFehler::~ObjektFehler()'
/usr/include/g++/exception:56: error: overriding `virtual
std::exception::~exception() throw ()'
objekt.h:10: error: looser throw specifier for `virtual
ObjektFehler::~ObjektFehler()'
/usr/include/g++/exception:56: error: overriding `virtual
std::exception::~exception() throw ()'
objekt.h:10: error: looser throw specifier for `virtual
ObjektFehler::~ObjektFehler()'
/usr/include/g++/exception:56: error: overriding `virtual
std::exception::~exception() throw ()'
objekt.cc:16: error: definition of implicitly-declared `virtual
ObjektFehler::~ObjektFehler()'
objekt.cc:16: error: declaration of `virtual ObjektFehler::~ObjektFehler()
throw ()' throws different exceptions
objekt.h:10: error: than previous declaration `virtual
ObjektFehler::~ObjektFehler()'
But as you said, objekt.h:
virtual ~ObjektFehler() throw(){};
works.
I also found, that some of these glitches were caused by the Makefile...
Well, I'm still puzzled a bit, but I'll investigate this.
Thanks for your help, Jonathan!
Dario