Qt TObject parent, undefined ref "vtable"


I try to connect ROOT to Qt. And, all work fine, before i don’t try to create class with parent a TObject. I write something like that:

class MyClass : public TObject
  MyClass() {;}
  Int_t a;
  Int_t b;
  ClassDef(MyClass, 1);

And, after i try to create this class i see next error:

error: undefined reference to `vtable for MyClass'

I tried to add a destructor of class and a few another hacks from Google. But im not fully understood, whats wrong?

Could you say me, what im doing wrong?


Try to add the destructor and create a LinkDef.h file containing:

#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ MyClass+;


And generate the dictionary for it. Something like:

rootcling -f MyDictionary.cxx -c MyClass.h Linkdef.h