[Interest] Three-file modules vs. moc

Thiago Macieira thiago.macieira at intel.com
Thu Aug 27 17:18:38 CEST 2020


On Wednesday, 26 August 2020 12:40:31 PDT Bernhard Lindner wrote:
> Hi!
> 
> Currently I am facing a problem with a Qt Creator managed Qt 5 project.
> 
> The projects consists of a lot of modules and implements a special but
> useful file concept. Each module has 3 files:
>    module.hpp - Public types, macros and declarations
>    module.inl - Template function definitions, constexpr and inline function
> definitions module.cpp - All other definitions
> module.cpp includes module.inl and module.inl includes module.hpp.

> How can I solve this problem on the moc side? Is there a way to tell moc via
> the .pro project on a per-module basis to include module.inl instead of (or
> along with) module.inl in moc_module.cpp?

Add to your module.cpp:

#include "moc_module.cpp"

This is recommended anyway, regardless of your problem. Always #include the 
module output for your headers in your corresponding .cpp files.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering





More information about the Interest mailing list