# Silence GCC warnings in CMake C++ standalone project with ROOT classes and dictionaries

**URL:** <https://root-forum.cern.ch/t/silence-gcc-warnings-in-cmake-c-standalone-project-with-root-classes-and-dictionaries/43500>\
**Category:** Evolution Proposals, Apps & Ideas\
**Tags:** cmake\
**Created:** [February 11, 2021, 1:07am UTC](https://root-forum.cern.ch/t/silence-gcc-warnings-in-cmake-c-standalone-project-with-root-classes-and-dictionaries/43500 "2021-02-11T01:07:12Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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, 11:12pm UTC](https://root-forum.cern.ch/t/silence-gcc-warnings-in-cmake-c-standalone-project-with-root-classes-and-dictionaries/43500/3 "2021-02-18T23:12:14Z")

</div>

I ended up removing the ROOT dictionary generation, which simplifies greatly the CMakeLists, using ClassDefInline as suggested by @pcanal.

> [@Warning in \<MyClass\>: The data members of MyClass will not be stored, because it inherits from TObject but does not have its own ClassDef](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/8):
>
> Well having a LinkDef let you control more carefully what the dictionary does and would give you an opportunity to suppress the warnings. Alternatively you could try a relatively new alternative (so you mileage may vary) and remove the dictionary generation altogether and add a ClassDefInline macro (instead of the ClassDef macro). If it works in you case, it will simply your build while still letting you use forward declaration. Cheers, Philippe.

---

_[View the full topic](https://root-forum.cern.ch/t/silence-gcc-warnings-in-cmake-c-standalone-project-with-root-classes-and-dictionaries/43500)._
