Computer/linux

undefined reference to `vtable for A'

citadel 2011. 12. 18. 02:45

a header file

class a : public TObject
{
public:
  A();
  virtual ~A() {};
}

Then I've got the linking error of g++ as follows:

undefined reference to `vtable for A'

The solution is to define the real destructor in source file.

a header file

class a : public TObject
{
public:
  A();
  virtual ~A();
}

a source file

A::~A()
{
}