[Development] QMetaMethod in Qt 6

Matthew Woehlke mwoehlke.floss at gmail.com
Thu May 28 20:21:14 CEST 2020

On 28/05/2020 13.19, Adam Light wrote:
> if a .cpp file has a #include "myclass.moc" type statement, that .cpp
> file has to be processed by moc
Huh? *Why*?

AFAIK that's just... wrong.

MOC needs to process files that do metaobject things (e.g. use 
Q_OBJECT). Including a .moc in a .cpp does not affect whether that .cpp 
does metoobject things. Either you already needed to process it, or you 
don't, and adding a .moc include doesn't change that. (And your *build 
system* should be, without doing *any* sort of resolution of includes, 
processing your input files to determine whether or not to even *invoke* 
MOC at all.)

This sounds like a problem with your build setup.


More information about the Development mailing list