# Qt TObject parent, undefined ref "vtable"

**URL:** <https://root-forum.cern.ch/t/qt-tobject-parent-undefined-ref-vtable/33023>\
**Category:** Newbie\
**Created:** [March 5, 2019, 10:36am UTC](https://root-forum.cern.ch/t/qt-tobject-parent-undefined-ref-vtable/33023 "2019-03-05T10:36:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vborchsh](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/97f17d/32.png) [@vborchsh](https://root-forum.cern.ch/u/vborchsh)\
**Post date:** [March 5, 2019, 10:36am UTC](https://root-forum.cern.ch/t/qt-tobject-parent-undefined-ref-vtable/33023/1 "2019-03-05T10:36:01Z")

</div>

Hello,

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:

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

```

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

```auto
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?

Thanks

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [March 5, 2019, 1:05pm UTC](https://root-forum.cern.ch/t/qt-tobject-parent-undefined-ref-vtable/33023/2 "2019-03-05T13:05:35Z")

</div>

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

```auto
#ifdef __CINT__

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

#pragma link C++ MyClass+;

#endif

```

And generate the dictionary for it. Something like:

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

```
