Results 1 to 5 of 5

Thread: How to avoid creation of MOC files on each compilation

  1. #1
    Join Date
    Sep 2007
    Location
    Pune, India
    Posts
    60
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to avoid creation of MOC files on each compilation

    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

  2. #2
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to avoid creation of MOC files on each compilation

    Add to you .pro file
    Qt Code:
    1. CONFIG += release
    To copy to clipboard, switch view to plain text mode 
    I'm a rebel in the S.D.G.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to avoid creation of MOC files on each compilation

    Quote Originally Posted by nileshsince1980 View Post
    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...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Sep 2007
    Location
    Pune, India
    Posts
    60
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to avoid creation of MOC files on each compilation

    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. Qt Code:
    2. 1
    3. CONFIG += release
    To copy to clipboard, switch view to plain text mode 

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

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to avoid creation of MOC files on each compilation

    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...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Eclipse, Moc Files, Custom Build Steps
    By gmat4321 in forum Qt Programming
    Replies: 4
    Last Post: 6th August 2010, 06:25
  2. Replies: 0
    Last Post: 23rd April 2009, 10:38
  3. Compilation OK, but the .exe files?
    By brasio in forum Installation and Deployment
    Replies: 1
    Last Post: 21st August 2008, 11:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.