need help with undefined reference errors

B

boyphp

I'm getting the following undefined reference errors:

foo_test.o(.gnu.linkonce.t._ZN7CFooD1Ev+0x18): In function
`CFoo::~CFoo()':
: undefined reference to `vtable for CFoo'
foo_test.o(.gnu.linkonce.t._ZN7CFooC1Ev+0x19): In function
`CFoo::CFoo()':
: undefined reference to `CFoo::rmap'
foo_test.o(.gnu.linkonce.t._ZN7CFooC1Ev+0x30): In function
`CFoo::CFoo()':
: undefined reference to `vtable for CFoo'

The implementation of the concerned functions is given below. I'm
pretty sure it is reading the file. What exactly could be going wrong?
------------------------------------------------------------------------------------------------------------------
class CFoo : public CIFoo
{
public:
CFoo() : CIFoo( PID_FOO, rmap) {};

CFoo( const CFoo& c ) : CIFoo( PID_Foo, rmap )
{
}

~CFoo()
{
}
private:
char* rmap;
};
 
F

freak

Without the full source code, I am guessing the base class `CIFoo' has
no virtual destructor.
 
V

Victor Bazarov

boyphp said:
I'm getting the following undefined reference errors:

foo_test.o(.gnu.linkonce.t._ZN7CFooD1Ev+0x18): In function
`CFoo::~CFoo()':
foo_test.o(.gnu.linkonce.t._ZN7CFooC1Ev+0x19): In function
`CFoo::CFoo()':
foo_test.o(.gnu.linkonce.t._ZN7CFooC1Ev+0x30): In function
`CFoo::CFoo()':

The implementation of the concerned functions is given below. I'm
pretty sure it is reading the file. What exactly could be going wrong?
[..]

Quoting the Standard:
"A virtual member function shall be declared pure _or_ defined
_or_ both."

That means you cannot declare a virtual function but not define it.
Also, it's possible that the base class of CFoo has pure d-tor...
The cod you posted does not have enough information in it.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top