Qt World Summit: Submit your Presentation

Build project including all libs

  • Hello, may it possible to setup the pro file to include all lib and files needed during build?

  • Lifetime Qt Champion


    What do you mean by include all lib and files ?

  • I would like to have next my exe all is need to run it when I copy the folder and past it to an other PC Under windows

  • Lifetime Qt Champion

    That's what windeployqt is for.

  • I start to read it, and I think it's not easy to do... I will try

  • @VRonin Great thanks it's a begining lol

    Could you explain me litle bit more how to use that?

    DLLDESTDIR = ../../myproject/bin (... some dir's struct ...)

    QMAKE_POST_LINK = windeployqt --compiler-runtime $$DLLDESTDIR

    DLLDESTDIR -- full path with file name TARGET (dll and exe).

    I don't really see what I have to complete or replace in that..

    Sorry I'm litle bit stupid lol

  • You chose the only answer with negative votes, I was referring to:

    isEmpty(TARGET_EXT) {
        win32 {
            TARGET_CUSTOM_EXT = .exe
        macx {
            TARGET_CUSTOM_EXT = .app
    } else {
    win32 {
        DEPLOY_COMMAND = windeployqt
    macx {
        DEPLOY_COMMAND = macdeployqt
    CONFIG( debug, debug|release ) {
        # debug
        DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/debug/$${TARGET}$${TARGET_CUSTOM_EXT}))
    } else {
        # release
        DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/release/$${TARGET}$${TARGET_CUSTOM_EXT}))
    #  # Uncomment the following line to help debug the deploy command when running qmake
    #  warning($${DEPLOY_COMMAND} $${DEPLOY_TARGET})
    # Use += instead of = if you use multiple QMAKE_POST_LINKs

  • oups sorry

  • @VRonin Hello, I try that but now the exe is missing and I can not run the project from qt creator, I got modules missing message (all modules imported in my project) I received message module not installed when I try to run

  • That has nothing to do with the snipped I posted. Could you show us your entire .pro file? Did you rmember to build->re-run qmake?

  • @VRonin here my original pro file:

    TEMPLATE = app
    QT += qml quick widgets
    CONFIG += c++11
    HEADERS += \
    SOURCES += main.cpp\
    RESOURCES += qml.qrc \
    # Additional import path used to resolve QML modules in Qt Creator's code model
    # Additional import path used to resolve QML modules just for Qt Quick Designer
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as been marked deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target

    What do you mean with Did you rmember to build->re-run qmake?

    Thank very much again for your help!!

  • Lifetime Qt Champion

    @filipdns said in Build project including all libs:

    What do you mean with Did you rmember to build->re-run qmake?

    You need to rerun qmake each time you change pro file. Go to "Build/Run qmake" menu.

    1. Using both widgets and quick modules is a bit unusual
    2. there is no trace of the snipped posted above in this file, where did you put it?

  • @VRonin I don't know, I start my project with QT exemple I didn't change more than the radialbar cpp and h

    I'm new on QT I probably made some mistakes ;-)

Log in to reply