[Interest] Is moc obsolete?

Igor Mironchik igor.mironchik at gmail.com
Wed Jul 8 21:32:18 CEST 2015



On 08.07.2015 22:19, Konstantin Tokarev wrote:
>
> 08.07.2015, 22:08, "Igor Mironchik" <igor.mironchik at gmail.com>:
>> Hi.
>>
>> On 08.07.2015 21:26, Till Oliver Knoll wrote:
>>>>   Am 08.07.2015 um 08:57 schrieb Igor Mironchik <igor.mironchik at gmail.com>:
>>>>
>>>>   Hi,
>>>>
>>>>   Does anybody know if Qt plans to remove moc in the future releases, let's say in Qt 6?
>>>   What's wrong with moc? :)
>>>
>>>   Seriously, while in the very beginning I was doubtful about an "additional build step that messes around with my source" moc never got into my way. Even with Visual Studio 6 and the corresponding Qt VS Addon back in the days one hardly noticed the presence of moc.
>>>
>>>   And all moc does is spit out some more C++ code, which - most importantly for me - I never get to see! So why would I care about moc?
>>>
>>>   Granted, initially moc did not take #defines and #ifdefs (mostly evil anyway) into account (IIRC moc now does some pre-processing on its own, or runs after the preprocess phase...), linker errors due to stale moc_* files occured (mostly due to different time stamps on network shares - "Try to compile in a minute! It'll work!") or "DLL export" issues then and when ("you need to DLL export the whole class that is going to be moc'ed - not just selected public/protected methods/symbols").
>>>
>>>   But from a practical standpoint - especially in combination with qmake/Qt Creator - IMHO moc does its job well: create a "meta system, signal/slot connections etc."
>>>
>>>   Or did I miss something?
>> With Qt 5.4.1 I had a problem with moc. One my QObject-derived class was
>> declared in source file (.cpp) and this source file at the end included
>> #include "source.moc". And what I had... When I run qmake and make from
>> command prompt all was ok. But when I compiled from QtCreator
>> compilation failed with: can't find "source.moc".
> Use "Run qmake" item in Build menu, then build your projet again.

I even completely removed all Makefile-s and then tried to build 
project... But with the same issue until I moved that QObject-derived 
class in the header... :)
>




More information about the Interest mailing list