QT/VC2008:Project is rebuilt every time even though I didn’t make any modifications

I have encountered problem when attempting to compile VC projects created by QT 4.5.2,VC always rebuilds the whole project when I start to run or build the project, even though I didn’t make any modifications to the code.the project is always “out of date”.

that is because the custom build step generated by QT for each header files that contain the Q_OBJECT macro are dependent on mocinclude.tmp,which being created every time the project is built,the mocinclude.tmp’s date is later than the header files,so the custom build rule will be run every time.

to solve this problem,open %QTDIR%/makespecs/features/moc.prf,comment out  these two lines(add ‘#’’ at the start of line):

!isEmpty(INCLUDETEMP):moc_source.depends += $$INCLUDETEMP 
......
!isEmpty(INCLUDETEMP):moc_header.depends += $$INCLUDETEMP

and run qmake –tp vc again to regenerate the project files.

1 thought on “QT/VC2008:Project is rebuilt every time even though I didn’t make any modifications”

Leave a Reply

Your email address will not be published.