Reputation: 5745
I'm getting this weird linker error:
Error 1 error LNK2019: unresolved external symbol "public: virtual __thiscall Data::~Data(void)" (??1Data@@UAE@XZ) referenced in function "public: virtual __thiscall Job::~Job(void)" (??1Job@@UAE@XZ) C:\...\Job.obj
Error 2 error LNK2019: unresolved external symbol "public: __thiscall List::DataNode::DataNode(class List::DataNode const &)" (??0DataNode@List@@QAE@ABV01@@Z) referenced in function "public: __thiscall List::List(class List const *)" (??0List@@QAE@PBV0@@Z) C:\...\List.obj
from the first error description, it might have something to do with a destructor.
I have an empty and abstract data class with a pure virtual destructor:
virtual ~Data()=0;
and a class Job which derives from data, with a trivial implementation of the destructor:
Job::~Job()
{
}
Can you spot a problem? How can I fix it? Thanks!
Upvotes: 1
Views: 288
Reputation: 206636
You need to provide definition for a pure virtual destructor.
C++03 12.4 Destructors
Para 7:
A destructor can be declared virtual (10.3) or pure virtual (10.4); if any objects of that class or any derived class are created in the program, the destructor shall be defined. If a class has a base class with a virtual destructor, its destructor (whether user- or implicitly- declared) is virtual.
Upvotes: 5