Virtual destructor causes LNK2001 !

B

balkanese

Hi everybody!

I encountered the following problem:

I created a "class library (.NET)" project and made a first build,
which produced a warning:
nochkclr.obj : warning LNK4099: PDB 'libc.pdb' was not found with
'C:\Programme\Microsoft Visual Studio .NET 2003\Vc7\lib\nochkclr.obj'
or ...

Ok, I ignored this warning and used the Wizard to generate a "Generic
C++ class" with a virtual destructor. When I now try to rebuild my
project I get two linker errors:
wiz.obj : error LNK2001: unresolved external symbol "void __cdecl
operator delete(void *)" (??3@$$FYAXPAX@Z)
and
wiz.obj : error LNK2001: unresolved external symbol "void __stdcall
`eh vector destructor iterator'(void *,unsigned int,int,void
(__thiscall*)(void *))" (??_M@$$FYGXPAXIHP6EX0@Z@Z)

When I remove the "virtual" keyword in front of the destructor
declaration both linker errors disappear!!! What the @&%$ is
going on here?!?!


Thank you for your help,
Matej
 
G

Guest

I don't know if it applies to your case, but are you implementing the destructor? Even with an empty {}? You'd need it.

Also, if your class is never going to be used as a parent class it's best not to declare the destructor virtual.
 

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

Top