[Interest] Again this problem but now on Linux

Sze Howe Koh szehowe.koh at gmail.com
Mon May 4 13:07:14 CEST 2015


On 4 May 2015 at 11:43, Hamish Moffatt <hamish at risingsoftware.com> wrote:
>
> On 04/05/15 13:08, Nikos Chantziaras wrote:
> > On 03/05/15 13:54, Igor Mironchik wrote:
> >> Hi guys,
> >>
> >> I asked before about similar problem on Windows but now I have the same
> >> problem on Linux.
> >>
> >> I have messagebox.cpp file that should be moced, and in the end of the
> >> file I do #include "messagebox.moc"
> > Since you're using qmake, you shouldn't include that. Manual inclusion
> > of moc files should only be done when using build systems that are
> > unable to do the moc'ing and building on their own. qmake does not need
> > that.
> >
> Oh, is that documented somewhere? We #include <moc_foo.cpp> for almost
> everything (though they get forgotten occasionally), but we're compiling
> with VS, Xcode and gnu make and none of those should need it. Is there a
> benefit to changing?

The documentation doesn't say that you *shouldn't* do something, but
see http://doc.qt.io/qt-5/moc.html -- it says that moc processes
*header* files.

If you define your classes in .h files (not .cpp files) and run qmake,
then you don't need to #include anything that moc produces.


Regards,
Sze-Howe



More information about the Interest mailing list