Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

No printed output from program started by QMAKE_POST_LINK



  • On Windows only:

    With Qt 5.9 and below (from a console app) I get qDebug and QTest output displayed in the Compile Output window when building the application and running with using the QMAKE_POST_LINK command. With Qt 5.11 I get no output. In both cases I get output if I explicitly execute the program after it is built.

    From Qt 5.9 I see QTest output:
    \libCommon.a -LC:\Qt\5.9.6\5.9.6\mingw53_32\lib C:\Qt\5.9.6\5.9.6\mingw53_32\lib\libQt5Testd.a C:\Qt\5.9.6\5.9.6\mingw53_32\lib\libQt5Cored.a
    ./debug/FileStoreTests.exe
    ********* Start testing of TestFileTest *********
    Config: Using QtTest library 5.9.6, Qt 5.9.6 (i386-little_endian-ilp32 shared (dynamic) debug build; by GCC 5.3.0)
    PASS : TestFileTest::initTestCase()
    PASS : TestFileTest::CreateObjectTest()

    From Qt.11 I see the program execute but no output.
    \FileStore\debug\libFileStore.a C:\Workspace\Projects\build-OSPF-Desktop_Qt_5_11_2_MinGW_32bit-Debug\Common\debug\libCommon.a
    -LC:\Qt\5.11.2\5.11.2\mingw53_32\lib C:\Qt\5.11.2\5.11.2\mingw53_32\lib\libQt5Testd.a C:\Qt\5.11.2\5.11.2\mingw53_32\lib\libQt5Cored.a
    ./debug/FileStoreTests.exe
    mingw32-make[4]: Leaving directory 'C:/Workspace/Projects/build-OSPF-Desktop_Qt_5_11_2_MinGW_32bit-Debug/BaseLibs/FileStore/FileStoreTests'

    In both cases I am using the version of QtCreator that comes with Qt 5.11, changing the SDK as needed.

    To test this yourself create a simple console program with a qDebug() statement. add the QMAKE_POST_LINK command to the project file as needed.

    Anyone else have this problem? Or am I overlooking some setting for Qt 5.11?

    ... / A



  • @alank said in No printed output from program started by QMAKE_POST_LINK:

    On Windows only:

    With Qt 5.9 and below (from a console app) I get qDebug and QTest output displayed in the Compile Output window when building the application and running with using the QMAKE_POST_LINK command. With Qt 5.11 I get no output. In both cases I get output if I explicitly execute the program after it is built.
    This output goes to "Application Output" which has number 3. "Compile Output" is number 4 and obtains only the qmake, compile and linking outputs.

    From Qt 5.9 I see QTest output:
    \libCommon.a -LC:\Qt\5.9.6\5.9.6\mingw53_32\lib C:\Qt\5.9.6\5.9.6\mingw53_32\lib\libQt5Testd.a C:\Qt\5.9.6\5.9.6\mingw53_32\lib\libQt5Cored.a
    ./debug/FileStoreTests.exe
    ********* Start testing of TestFileTest *********
    Config: Using QtTest library 5.9.6, Qt 5.9.6 (i386-little_endian-ilp32 shared (dynamic) debug build; by GCC 5.3.0)
    PASS : TestFileTest::initTestCase()
    PASS : TestFileTest::CreateObjectTest()

    From Qt.11 I see the program execute but no output.
    \FileStore\debug\libFileStore.a C:\Workspace\Projects\build-OSPF-Desktop_Qt_5_11_2_MinGW_32bit-Debug\Common\debug\libCommon.a
    -LC:\Qt\5.11.2\5.11.2\mingw53_32\lib C:\Qt\5.11.2\5.11.2\mingw53_32\lib\libQt5Testd.a C:\Qt\5.11.2\5.11.2\mingw53_32\lib\libQt5Cored.a
    ./debug/FileStoreTests.exe
    mingw32-make[4]: Leaving directory 'C:/Workspace/Projects/build-OSPF-Desktop_Qt_5_11_2_MinGW_32bit-Debug/BaseLibs/FileStore/FileStoreTests'

    In both cases I am using the version of QtCreator that comes with Qt 5.11, changing the SDK as needed.

    To test this yourself create a simple console program with a qDebug() statement. add the QMAKE_POST_LINK command to the project file as needed.

    Anyone else have this problem? Or am I overlooking some setting for Qt 5.11?

    ... / A

    AKAIK QMAKE_POST_LINK is only executed directly after linking, when it happened. A failure in linking skips that step. Your description reflects my experience with QMAKE_POST_LINK. The command added with QMAKE_POST_LINK can be found in the "Compilation Output" pane, when it is executed.

    However why are starting the application after its linking process with QMAKE_POST_LINK at all?
    Qt creator distinguishes between building and running an application in somewhat separate blocks. A QMAKE_POST_LINK falls into the building block and is there for additional steps to conclude the building.
    When I like to build and run my application I am simply pressing "Ctrl+r". It checks if the application has to be build and eventually starts the building process. When building was not necessary or the building process was successful it starts the application.



  • There is no error in the linking steps. The exe is built and I can see it running in the TaskManager. As to why I do this - it is so I can automatically run unit tests at build time. I build a library, then test it, then build the next library and test it, etc, etc. It is all part of automation.


  • Qt Champions 2019

    @alank Why do you need the exe of your app to run unit tests? It sounds more like you're doing system tests. Unit tests are usually built as own executables containing only parts needed for the unit tests without whole application.


  • Lifetime Qt Champion

    Looks like this has lead to QTCREATORBUG-21238.


Log in to reply