Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [Solved] Prevent MOC compilation if .h file is not modified

[Solved] Prevent MOC compilation if .h file is not modified

Scheduled Pinned Locked Moved Qt Creator and other tools
9 Posts 2 Posters 5.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mcunha
    wrote on last edited by
    #1

    Hello,

    I'm using qt under microsoft visual Studio 2008. The compilation of my project takes a long time because moc.exe is executed for all .h files even if there are not modified since the last compilation. Is there a way to prevent this ?

    Regards.

    mcunha

    mcunha.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcunha
      wrote on last edited by
      #2

      I have the same question for ui files. I hope that it's the same solution

      mcunha.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        Hi there,

        welcome to the forum.

        Are you using "vsaddin":http://qt.nokia.com/downloads/visual-studio-add-in together with visual studio?
        I have noticed similar behaviour before and there are similar posts to be found on devnet. Apparently, there are issues when an .pro file is imported to vs. "Maybe this will help you":http://developer.qt.nokia.com/forums/viewthread/7658/#45053

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcunha
          wrote on last edited by
          #4

          Hi,

          Thanks for your reply. I'm not using vsaddin. I've added the moc command to the properties of my .h files.

          mcunha.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            [quote author="mcunha" date="1310997452"] I'm not using vsaddin. I've added the moc command to the properties of my .h files.
            [/quote]

            This might be the origin of your problem. I am using the vsaddin. It setups different folders for debug and release mocs.

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mcunha
              wrote on last edited by
              #6

              OK I'm going to use it !

              Could you tell me waht these 4 settings in the vsAddin options refer to ?

              ask_before_checkout_file
              disable_auto_MOC_steps_update_
              disable_checkout_files
              lupdateOnBuild

              Thanks for your help.

              mcunha.

              1 Reply Last reply
              0
              • K Offline
                K Offline
                koahnig
                wrote on last edited by
                #7

                I am a user of vsAddin as you. I can only guess on these definitions. The parameters have never being changed in my setup, at least as I remember. So they should be still the default values.

                ask_before_checkout_file True
                disable_auto_MOC_steps_update_ False
                disable_checkout_files False
                lupdateOnBuild False

                The first and third setting are probably for some versioning system (e.g. svn).
                With the second you may apparently change the mocing behaviour. However, the current setting seem to be fine for my applications. Possibly you have to change to avoid frequent mocing without having changed anything.
                The forth is obviously a parameter for lupdate tool.
                The only thing I have changed is the MocDirectory and the default version of Qt being used. When you are changing the MocDirectory you may want to have a dependency to the configuration in there
                (e.g. .\GeneratedFiles$(PlatformName)$(ConfigurationName) or .\GeneratedFiles$(ConfigurationName) ).

                If all this does not cure your problem, you may need to exclude the individual .h file from build. This should prevent the mocing. However, personally, I would not be keen to do so. You need to remember when you have done a change :-(

                Vote the answer(s) that helped you to solve your issue(s)

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mcunha
                  wrote on last edited by
                  #8

                  Thanks a lot for all your remark.

                  mcunha.

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    koahnig
                    wrote on last edited by
                    #9

                    You are welcome.

                    If this solved your problem, please mark it in the title line with [solved]. This may help others then.

                    Vote the answer(s) that helped you to solve your issue(s)

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved