Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Started using precompiled header and still building in Qt Creator takes days.. I can't wait 2minutes each time!!!

Started using precompiled header and still building in Qt Creator takes days.. I can't wait 2minutes each time!!!

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 6 Posters 795 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.
  • enjoysmathE Offline
    enjoysmathE Offline
    enjoysmath
    wrote on last edited by
    #1

    I put the -MP flag into the .pro file as instructed by the top article when you google something like "Speed up Qt creator build". It also suggested precompiled header and so I spent 2 hours getting that set up and only put in things that are included at least 3 times across app code.

    There was talk about "forwarding" which I don't know how to do, but at this rate I don't think it will matter. Run-time performance of the app in Release mode is great.

    Also I don't like when clangd does its indexing, etc. All these automated features are dragging my computer down especially in > 80*F weather. Why can't we have fast builds - this is C++ ?

    https://github.com/enjoysmath
    https://math.stackexchange.com/users/26327/exercisingmathematician

    J.HilkJ 1 Reply Last reply
    0
    • enjoysmathE Offline
      enjoysmathE Offline
      enjoysmath
      wrote on last edited by enjoysmath
      #2

      How much memory does my Win 10 machine need to run Qt Creator. Is it 64 GB or only 32GB? Can it be optimized by dropping some of the options in the maintenance tool?

      https://github.com/enjoysmath
      https://math.stackexchange.com/users/26327/exercisingmathematician

      1 Reply Last reply
      0
      • JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        Qt Creator does not "take time", and does not do the builds itself. What you are talking about is the compiler you are using to compile & link your code. Which depends on the specs of your machine, what platform you are on, which compiler you are using, what options you do/do not pass to the compiler and most vitally how big the code you are compiling is. About which you don't say anything.

        Creator, or for that matter building, does not require 64GB nor even 32GB. Both ought be more than adequate. Unless you see the machine "swapping"/"paging" all the time you are more likely to be limited by the CPU speed.

        If you have multiple cores you can (tell Creator to tell) the "make" to use more than one core to compile separate files in parallel where it can, that can help.

        You talk about "days" to build on the one hand and "2 minutes" on the other hand. Those are not the same!

        BTW, you can do the whole compilation/link from outside of Creator, on the command-line, and thereby rule Creator out of the equation.

        So how about stating what/how big the code is you are compiling and how long it actually takes?

        1 Reply Last reply
        1
        • C Offline
          C Offline
          ChrisW67
          wrote on last edited by
          #4

          @enjoysmath said in Started using precompiled header and still building in Qt Creator takes days.. I can't wait 2minutes each time!!!:

          If you are waiting 2 minutes each time you change your code then you are doing something odd. Only the source file(s) that changed since the last build should be compiled creating new object files for those components only, before the entire program/library is linked using all the interim object files from the build area. This is the entire purpose of your make/nmake/jom program.

          Unless your source code measures in the millions of lines and you build the entire thing every time, then I cannot see much taking that long to compile.

          Given that you are compiling with the Microsoft suite (given away by the mention of the -MP parameter) you can play with the option's number argument to limit the CPUs used if there is other processing occurring on the machine that you are colliding with.

          My daily Qt/compile machine runs happily on 16GB RAM and I have worked on machines with only 8GB.

          Also I don't like when clangd does its indexing, etc. All these automated features are dragging my computer down...

          For the CLang code model, turn it off if it bugs you that much. From the docs:

          To use the built-in code model instead, select Help > About Plugins > C++, and deselect the ClangCodeModel check box. Select Restart Now to restart Qt Creator and have the changes take effect.

          especially in > 80*F weather.

          If your computer performance is broken in 27 Celsius temperatures then I would suspect that the cooling system is performing poorly and your CPU is quite possibly throttling itself to mitigate damage. Check your CPU temperature.
          My machine quite happily churns along compiling in weather like that as a matter of routine.

          If Qt Creator bugs you that much then you are free to use any editor of your choice and build yourself. You will still have compiler performances issues: these are not Qt Creator.

          1 Reply Last reply
          0
          • enjoysmathE Offline
            enjoysmathE Offline
            enjoysmath
            wrote on last edited by
            #5

            Okay, I can't wait days or weeks for this crapware to compile. My own crapware that I wrote, but....

            Anyway, found a solution (maybe):

            https://www.qt.io/blog/qt-vs-tools-for-visual-studio-2022

            So you install it via Exensions > Manage Extensions > Search : "Qt" > Qt Tools for Visual Studio

            I'd be 10x more comfortable in VS I think. I will report back with how it goes. If it even goes.

            https://github.com/enjoysmath
            https://math.stackexchange.com/users/26327/exercisingmathematician

            1 Reply Last reply
            0
            • enjoysmathE Offline
              enjoysmathE Offline
              enjoysmath
              wrote on last edited by enjoysmath
              #6

              Okay, I got the basic QtWidgets helloworld working in VS using the Qt Tools for VS. Now I have to import my projects' files :O

              https://github.com/enjoysmath
              https://math.stackexchange.com/users/26327/exercisingmathematician

              S 1 Reply Last reply
              0
              • VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by
                #7

                The most common way to speed up compilation is to run it parallel.

                • what tool are you using to build (make/mingw-make, nmake, ninja, jom)?
                • What is your build based on (qmake, CMake, Qbs)?

                All these automated features are dragging my computer down especially in > 80*F weather.

                The clang code model is quite heavy you can disable it at the cost of less pre-compilation error/warnings in Qt Creator

                How much memory does my Win 10 machine need to run Qt Creator. Is it 64 GB or only 32GB?

                My laptop is from the stone age and copes fine with Qt Creator with clang code model with only 8GB. Of course, the more the better

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                1 Reply Last reply
                3
                • enjoysmathE enjoysmath

                  Okay, I got the basic QtWidgets helloworld working in VS using the Qt Tools for VS. Now I have to import my projects' files :O

                  S Offline
                  S Offline
                  SimonSchroeder
                  wrote on last edited by
                  #8

                  @enjoysmath said in Started using precompiled header and still building in Qt Creator takes days.. I can't wait 2minutes each time!!!:

                  Now I have to import my projects' files :O

                  This part is easy: Inside a command line (making sure you have MSVC correctly set up, e.g. through vcvarsall.bat) run qmake.exe -tp vc MyProject.pro. This produce a Visual Studio project file. However, from my experience the dependencies in the VS project are worse. A lot of moc files get recompiled (including some dependencies) every time. This doesn't happen when using a qmake-based project. If you have a CMake-based project you should be able to open it in VS directly.

                  There are certain things you can try to further speed up builds. There is compiler caching, unity builds and distributed builds. Unity builds can be enabled in VS directly (at least it was experimental at some point). For distributed builds there is IncrediBuild (paid). If you want everything at once you can try FASTBuild. There is a set of scripts that will get you started based on a qmake project (https://github.com/SimonSchroeder/QMake2Fastbuild). You can also create a VS project from your FASTBuild project (VS will then use FASTBuild for compilation).

                  Maybe one thing about long build times and pre-compiled headers: We only put external libraries into the pre-compiled header. Otherwise you might change a little thing in one header and everything gets rebuild because on the dependency on the pre-compiled header.

                  1 Reply Last reply
                  0
                  • enjoysmathE enjoysmath

                    I put the -MP flag into the .pro file as instructed by the top article when you google something like "Speed up Qt creator build". It also suggested precompiled header and so I spent 2 hours getting that set up and only put in things that are included at least 3 times across app code.

                    There was talk about "forwarding" which I don't know how to do, but at this rate I don't think it will matter. Run-time performance of the app in Release mode is great.

                    Also I don't like when clangd does its indexing, etc. All these automated features are dragging my computer down especially in > 80*F weather. Why can't we have fast builds - this is C++ ?

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by J.Hilk
                    #9

                    @enjoysmath inside the project settings, to what is the number of parallel jobs set ?

                    2645ec62-a5c5-4983-8b44-4d969f67b1e5-image.png

                    if you're on windows, what I think you are, and if you're using MSVC, than this may be set to 1 instead of the number of available cores

                    There was talk about "forwarding" which I don't know how to do

                    forwarding, I could try to explain it,. but I think this SO answer is actually quite awesome and better than anything I could quickly write up:
                    https://stackoverflow.com/a/4757718/15422846


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    1 Reply Last reply
                    2

                    • Login

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