[SOLVED] Run qmake and Build in Creator



  • What's the relationship between above two.

    Why I have to run Run qmake sometimes before click Build?
    I thought the Build will do everything for you to create the final executable. But it seems not true sometimes.

    Then, when should I trigger Run qmake in Creator?



  • Hi,
    In a nutshell the qmake generates platform dependent makefiles for all your files needed to compile. Also qmake generates files converted from your designer forms into compilable code in C++.
    When nothing changes in your designer and no files are included extra no need to do a qmake run. Only a build will regenerate your application.
    Now it is possible that you did include more files/added widgets etc to your application, but somehow the build sequence didn't register that. It will use the old files on your system and your code will not compile. When qmake is run again new makefiles are generated including your new files etc causing the build to "rebuild" your code.
    Qmake doesn't need to be run often and the build (better to do a clean/rebuild when in doubt) will get compile errors.
    The build will only rebuild files that have been changed, but when qmake changes the makefile all files are rebuild, so often errors disappear.
    Hope this might help, but qmake is normally not to blame, but the compiler (build) is.



  • Hi,
    Note that, Build or ReBuild will run qmake only when xxx.pro is newer than Makefile. In other cases, if your makefile need update, qmake must be called manually.


    qmake is used to generate the platform dependent makefiles.

    @
    xxx.pro ==> Makefile
    @

    When xxx.pro is changed, qmake will be called automaticly to re-generate the makefiles.

    However,in some cases, such as when Q_OBJECT is added to an exist xxx.h or xxx.cpp file which doesn't contain a Q_OBJECT before. Though .pro file doesn't changed, makefile must be updated to include the moc rules, so qmake must be called manually.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.