[Interest] porting to Qt 5.4 - MOC very slow on Windows

Hamish Moffatt hamish at risingsoftware.com
Fri Jan 16 01:53:34 CET 2015

On 16/01/15 09:35, Henry Skoglund wrote:
>   > I'm trying to port our app from Qt 4.8 to 5.4.
>   > Currently working in MSVC 2013,
>   > and using the pre-built Qt binaries for that environment.
>   >
>   > We have about 440 files being MOCed during build. On 5.4, each file
>   > is taking 2-3 seconds meaning the overall build is significantly
>   > longer than in 4.8.
>   >
>   > I found a reference to a similar problem here -
>   > http://qt-project.org/forums/viewthread/47901 - which was due to using
>   > MOC on a network drive. In my case everything is on local SSD.
>   >
>   > Any suggestions?
> One trick I've used for speedup; since MOC ignores your .cpp files, is
> to move #includes of external .h files, for example
> windows.h, from myclass.h to myclass.cpp.
Thanks Henry. That's good practice anyway - your .h is your interface to 
other source modules, so if you don't need <windows.h> for example as 
part of your interface, you shouldn't include it from your .h. This 
applies to your own headers too (not just system/Qt headers), else you 
end up waiting on long rebuilds if you change those headers.

Unfortunately this means I've already done much of what I can and my MOC 
times are still terrible :-)


More information about the Interest mailing list