473,500 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"[in-charge]"

Hi, need your help again.
Compiling a code gives me the following:

home/phlox/sources/msw/server/einspieler.cc:430: undefined reference
to `ObjektFehler::~ObjektFehler [in-charge]()'
einspieler.o(.text+0x1f42):/home/phlox/sources/msw/server/einspieler
.cc:446: undefined reference to `ObjektFehler::~ObjektFehler
[in-charge]()
[...]

l.430 in einspieler.cc looks like this:

catch (ObjektFehler fehler) {};

An included file contains the definition:

class ObjektFehler : exception{
[...]
virtual ~ObjektFehler() throw();
}

Any ideas, what to do? Thx in advance!

Dario
Jul 22 '05 #1
7 3736
"Dario Kampkaspar" <ph***@dario.wh.uni-heidelberg.de> wrote:
Hi, need your help again.
Compiling a code gives me the following:

home/phlox/sources/msw/server/einspieler.cc:430: undefined reference
to `ObjektFehler::~ObjektFehler [in-charge]()'
einspieler.o(.text+0x1f42):/home/phlox/sources/msw/server/einspieler
.cc:446: undefined reference to `ObjektFehler::~ObjektFehler
[in-charge]()
[...]

l.430 in einspieler.cc looks like this:

catch (ObjektFehler fehler) {};

An included file contains the definition:

class ObjektFehler : exception{
[...]
virtual ~ObjektFehler() throw();
This is just a declaration. It must be defined somewhere. Is it?
}


Jonathan
Jul 22 '05 #2
"Jonathan Turkanis" <te******@kangaroologic.com> writes:
"Dario Kampkaspar" <ph***@dario.wh.uni-heidelberg.de> wrote:
Hi, need your help again.
Compiling a code gives me the following:

home/phlox/sources/msw/server/einspieler.cc:430: undefined reference
to `ObjektFehler::~ObjektFehler [in-charge]()'
einspieler.o(.text+0x1f42):/home/phlox/sources/msw/server/einspieler
.cc:446: undefined reference to `ObjektFehler::~ObjektFehler
[in-charge]()
[...]

l.430 in einspieler.cc looks like this:

catch (ObjektFehler fehler) {};

An included file contains the definition:

class ObjektFehler : exception{
[...]
virtual ~ObjektFehler() throw();


This is just a declaration. It must be defined somewhere. Is it?


Nope, didn't find any defintion. But, isn't throw() a command making
~ObjektFehler both declared and defined?

As I do not know what my friend exactly wanted this to do and I didn't
do much with exception handling up to now, any idea what I could do to
make this run? How should a minimum definition of this look like?

Thanks,
Dario
Jul 22 '05 #3

"Dario Kampkaspar" <ph***@dario.wh.uni-heidelberg.de> wrote in message
news:c1**********@news.urz.uni-heidelberg.de...
"Jonathan Turkanis" <te******@kangaroologic.com> writes:
"Dario Kampkaspar" <ph***@dario.wh.uni-heidelberg.de> wrote:
Hi, need your help again.
Compiling a code gives me the following:

home/phlox/sources/msw/server/einspieler.cc:430: undefined reference to `ObjektFehler::~ObjektFehler [in-charge]()'
einspieler.o(.text+0x1f42):/home/phlox/sources/msw/server/einspieler .cc:446: undefined reference to `ObjektFehler::~ObjektFehler
[in-charge]()
[...]

l.430 in einspieler.cc looks like this:

catch (ObjektFehler fehler) {};

An included file contains the definition:

class ObjektFehler : exception{
[...]
virtual ~ObjektFehler() throw();
This is just a declaration. It must be defined somewhere. Is

it?
Nope, didn't find any defintion. But, isn't throw() a command making
~ObjektFehler both declared and defined?

As I do not know what my friend exactly wanted this to do and I didn't do much with exception handling up to now, any idea what I could do to make this run? How should a minimum definition of this look like?


throw() is an exception specification -- in this case a promise not to
throw any exceptions, which the compiler will enforce to a limited
extent. Destructors should almost never throw exceptions (I say almost
because basic_ostream::sentry::~sentry() can throw). Some people will
say that instead of an exception specification it would be better here
just to have a comment: // never throws.

At any rate, adding an exception specification does not count as a
definition (or as a 'command', for that matter). To provide a
definition, all you need is this:

virtual ~ObjektFehler() { }

(Of course, depending on the details of the implementation, the
destructor may need to do more.)

Jonathan


Jul 22 '05 #4
Hi again,
>> home/phlox/sources/msw/server/einspieler.cc:430: undefined reference >> to `ObjektFehler::~ObjektFehler [in-charge]()'
>> einspieler.o(.text+0x1f42):/home/phlox/sources/msw/server/einspieler >> .cc:446: undefined reference to `ObjektFehler::~ObjektFehler
>> [in-charge]()
>> [...]
>>
>> l.430 in einspieler.cc looks like this:
>>
>> catch (ObjektFehler fehler) {};
>>
>> An included file contains the definition:
>>
>> class ObjektFehler : exception{
>> [...]
>> virtual ~ObjektFehler() throw();
>
throw() is an exception specification -- in this case a promise not to
throw any exceptions, which the compiler will enforce to a limited
extent. Destructors should almost never throw exceptions (I say almost
because basic_ostream::sentry::~sentry() can throw). Some people will
say that instead of an exception specification it would be better here
just to have a comment: // never throws.

At any rate, adding an exception specification does not count as a
definition (or as a 'command', for that matter). To provide a
definition, all you need is this:

virtual ~ObjektFehler() { }


Okay, now it looks like this.
objekt.h (18):
virtual ~ObjektFehler() throw();

objekt.cc (11):
virtual ObjektFehler::~ObjektFehler(){}

This gives me the following error:

objekt.cc:11: error: virtual outside class declaration
objekt.cc:11: error: declaration of `virtual ObjektFehler::~ObjektFehler()'
throws different exceptions
objekt.h:18: error: than previous declaration `virtual
ObjektFehler::~ObjektFehler() throw ()'

Or should I put it elsewhere?

Greets

Dario
Jul 22 '05 #5

"Dario Kampkaspar" <ph***@dario.wh.uni-heidelberg.de> wrote in message
news:c1**********@news.urz.uni-heidelberg.de...
Hi again,
Okay, now it looks like this.
objekt.h (18):
virtual ~ObjektFehler() throw();

objekt.cc (11):
virtual ObjektFehler::~ObjektFehler(){}

This gives me the following error:

objekt.cc:11: error: virtual outside class declaration
objekt.cc:11: error: declaration of `virtual ObjektFehler::~ObjektFehler()' throws different exceptions
objekt.h:18: error: than previous declaration `virtual
ObjektFehler::~ObjektFehler() throw ()'


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.

jonathan
Jul 22 '05 #6
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
Jul 22 '05 #7

"Dario Kampkaspar" <ph***@dario.wh.uni-heidelberg.de> wrote in message
news:c1**********@news.urz.uni-heidelberg.de...
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();


You still need the parentheses after ObjektFehler.

virtual ~ObjektFehler() throw();

The parentheses after ObjektFehler delimit the argument-list; those
after throw delimit the list of allowed exceptions.

Jonathan
Jul 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2074
by: Diandian Zhang | last post by:
Does anyone have an idea, how to do it? Thanks in advance!
3
1845
by: Roy | last post by:
Anyone have any links and/or code samples demonstrating how this can be done? Current procedure is that john doe clicks an item on a datagrid of mine and after however long, gets the info he wants....
2
1547
by: Johann Blake | last post by:
I posted a related problem today. The problem is this: string str1 = @""""; When I execute this code (even in a bare bones application), in the IDE it returns "\""" Why? Even in the...
3
2690
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include ...\ProjectB\Dist\Include Each of the include...
1
4721
by: tankbattle | last post by:
That is, what's the difference between <complexType name="Address" final="restriction"> <sequence> <element name="name" type="string"/> <element name="street" type="string"/> <element...
2
3899
by: keithtracypierce | last post by:
1)Access2003, beating my head against the wall, every other iteration is "can't find macro Upshift" followed by carefully verifying that no blank properties have been entered. Making NO changes at...
3
2923
by: Chen ShuSheng | last post by:
HI, I am now study a segment of codes: ------------------------ printf("%p\t",fp); /*add by me*/ fseek(fp, 0L, SEEK_END); /* go to end of file */ printf("%p\t",fp); ...
9
2124
by: Ronald S. Cook | last post by:
Can I write If MyString = "Apple" Or MyString = "Orange" Or MyString = "Pear" Then to something more compact like If MyString In ("Apple", "Orange", "Pear") Then My last line obviously...
3
2978
by: DrVitoti | last post by:
On that program the compiler says "parse error" on line 8, 10, 12 and 21, it also says "too many arguments" on lines 10, 12 and finally it says "at this port in" on lines 13, 14, 20 . How could I...
4
3871
by: fran7 | last post by:
Hi, from help in the javascript forum I found the error in some code but need help. This bit of code works perfectly, trouble is I am writing it to a javascript function so the height needs to be in...
0
7136
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7232
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6906
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7397
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4923
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4611
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3110
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.