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

QT 6.0.1 Windows 10x64 - an empty default console app can't be started



  • Hello,

    Trying to learn C++ and QT (QT 6.0.1 under Windows 10x64) and my QT Creator can't start even an empty default QT console app.

    So, I have just main.cpp:

    #include <QCoreApplication>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
    
        return a.exec();
    }
    
    

    and the .pro file:

    QT -= gui
    
    CONFIG += c++11 console
    CONFIG -= app_bundle
    
    # You can make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    # DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
            main.cpp
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    

    The kit is "Desktop QT 6.0.1 MinGW 64-bit"

    The compile output is:

    23:50:12: Running steps for project myconsole...
    23:50:12: Starting: "C:\Qt\6.0.1\mingw81_64\bin\qmake.exe" C:\Users\aloz\source\QTProjects\myconsole\myconsole.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
    23:50:12: The process "C:\Qt\6.0.1\mingw81_64\bin\qmake.exe" exited normally.
    23:50:12: Starting: "C:\Qt\Tools\mingw810_64\bin\mingw32-make.exe" -f C:/Users/aloz/source/QTProjects/build-myconsole-Desktop_Qt_6_0_1_MinGW_64_bit-Debug/Makefile qmake_all
    mingw32-make: Nothing to be done for 'qmake_all'.
    23:50:12: The process "C:\Qt\Tools\mingw810_64\bin\mingw32-make.exe" exited normally.
    23:50:12: Starting: "C:\Qt\Tools\mingw810_64\bin\mingw32-make.exe" -j8
    C:/Qt/Tools/mingw810_64/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory 'C:/Users/aloz/source/QTProjects/build-myconsole-Desktop_Qt_6_0_1_MinGW_64_bit-Debug'
    g++ -c -fno-keep-inline-dllexport -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_CORE_LIB -I../myconsole -I. -IC:/Qt/6.0.1/mingw81_64/include -IC:/Qt/6.0.1/mingw81_64/include/QtCore -Idebug -IC:/Qt/6.0.1/mingw81_64/mkspecs/win32-g++  -o debug\main.o ..\myconsole\main.cpp
    g++ -Wl,-subsystem,console -mthreads -o debug\myconsole.exe debug/main.o  C:\Qt\6.0.1\mingw81_64\lib\libQt6Core.a   
    mingw32-make[1]: Leaving directory 'C:/Users/aloz/source/QTProjects/build-myconsole-Desktop_Qt_6_0_1_MinGW_64_bit-Debug'
    23:50:15: The process "C:\Qt\Tools\mingw810_64\bin\mingw32-make.exe" exited normally.
    23:50:15: Elapsed time: 00:03.
    

    An application output is:

    23:49:31: The program has unexpectedly finished.
    23:49:31: The process was ended forcefully.
    23:49:31: C:\Users\aloz\source\QTProjects\build-myconsole-Desktop_Qt_6_0_1_MinGW_64_bit-Debug\debug\myconsole.exe crashed.
    

    Something with mingw?

    after the build I got .exe file that if to start by manually got some errors that some DLLs are missed (Qt6Core, libgcc_s_seh-1,libstdc++-6)

    If to copy them from \Qt\6.0.1\mingw81_64\bin\ I got the error message 0xc000007b (possible means that x32 and x64 are mixed)

    How to fix it at least to start an empty console app by QT Creator?

    Thank you!



  • Found solution: it was very easy, but need to add to PATH environment variable: c:\Qt\6.0.1\mingw81_64\bin
    And now it builds and runs successfully.
    p.s. And if to check the box: Projects / Run / Run in terminal - an app. will start is a separate console, as c# console app under Visual Studio :)


Log in to reply