# Warning in \<MyClass\>: The data members of MyClass will not be stored, because it inherits from TObject but does not have its own ClassDef

**URL:** <https://root-forum.cern.ch/t/warning-in-myclass-the-data-members-of-myclass-will-not-be-stored-because-it-inherits-from-tobject-but-does-not-have-its-own-classdef/43597>\
**Category:** ROOT\
**Tags:** cling\
**Created:** [February 18, 2021, 1:25pm UTC](https://root-forum.cern.ch/t/warning-in-myclass-the-data-members-of-myclass-will-not-be-stored-because-it-inherits-from-tobject-but-does-not-have-its-own-classdef/43597 "2021-02-18T13:25:43Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [February 18, 2021, 10:09pm UTC](https://root-forum.cern.ch/t/warning-in-myclass-the-data-members-of-myclass-will-not-be-stored-because-it-inherits-from-tobject-but-does-not-have-its-own-classdef/43597/7 "2021-02-18T22:09:49Z")

</div>

Hmmm, but I do not have any LinkDef file in my CMake project.

As I just wanted a minimal GUI class deriving from TGMainFrame, I call the ROOT\_GENERATE\_DICTIONARY without using the LINKDEF argument, as done here:

> [@Classdef](https://root-forum.cern.ch/t/classdef/22337/5):
>
> As Philippe pointed out, you need to link against the generated dictionary of our class. Just changing slightly the CMakeLists.txt file like this should work. cmake\_minimum\_required(VERSION 2.8) project(tbjcAnalysis) list(APPEND CMAKE\_PREFIX\_PATH $ENV{ROOTSYS}) find\_package(ROOT) include(${ROOT\_USE\_FILE}) include\_directories(${ROOT\_INCLUDE\_DIRS}) add\_definitions(${GCC\_COVERAGE\_COMPILE\_FLAGS}) include\_directories(${PROJECT\_SOURCE\_DIR}/include) ROOT\_GENERATE\_DICTIONARY(G\_\_test include/test.h)…

Or is it a bad practice not to specify a LinkDef?

---

_[View the full topic](https://root-forum.cern.ch/t/warning-in-myclass-the-data-members-of-myclass-will-not-be-stored-because-it-inherits-from-tobject-but-does-not-have-its-own-classdef/43597)._
