PDA

View Full Version : How to avoid creation of MOC files on each compilation



nileshsince1980
28th May 2009, 14:47
Hi All,

In my QT application I have to use Signal/Slot in many file so I have to create 2 MOC file (for debug & release) for each file.
On every compilation my project creates MOC files and compiles it. Some how I want avoid each time creation of MOC file. I want to create whenever I need it as I know it.
This is will save compilation time.
Even I know I am not going to use any debug related macro so I dont want to create 2 seperate MOC files (for debug & release).
telll me the solution or work around for this ?

Thanks in advance.

Nilesh

lyuts
28th May 2009, 16:21
Add to you .pro file


CONFIG += release

wysota
28th May 2009, 18:17
Even I know I am not going to use any debug related macro so I dont want to create 2 seperate MOC files (for debug & release).

Implement your own rules for calling moc. You'll have to somehow make sure a proper directory is included into compilation in both modes (moc files land in different directories for debug and release).

The real question is why would you want to compile an application in two modes at once. It does make sense for libraries but not really for applications. I'm always wondering why people do that...

nileshsince1980
29th May 2009, 05:54
thanks lyuts and wysota.
Some addtion, I am creating library using Qt in Visual Studio 2003/Linux.

lyuts,

Add to you .pro file


Qt Code:
1
CONFIG += release

I didn't get how to do above things and as I am using Visual Studio 2003 how it will help.

wysota
29th May 2009, 08:00
If you are using Visual Studio then you are on your own. You have to reprogram Visual Studio manually. If you don't know how to do it I suggest you forget it and live with a bit longer compilation. You can compensate it by using precompiled headers, for example...