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

Unable to run an application standalone after adding WIN32 in CMakeLists.txt



  • Hello,

    We are trying to deploy a GUI application on Windows 10. The application runs without any problems when started from Qt IDE.
    After copying all the required .dlls inside the Release folder, we are also able to start the application from the explorer but only
    as a console application. To avoid the console, after some research we came across this link https://cmake.org/cmake/help/v3.0/command/add_executable.html and this https://cmake.org/cmake/help/v3.0/prop_tgt/WIN32_EXECUTABLE.html#prop_tgt:WIN32_EXECUTABLE which states that after using add_executable(TARGET [WIN32] ...)
    we should be able to start the application as a GUI application instead of a console application. However, after making these changes the application does not start at all, there are no error messages being displayed!

    As, a test we created a Qt QWidgets test application and tried running it from the explorer with the WIN32 flag added in CMakeLists.txt and this seems to work fine.

    We also ran the executables through dependency walker which says that the application crashes with:
    First chance exception 0x406D1388 (Thread was named) occurred in "c:\windows\system32\KERNELBASE.DLL" at address 0x00007FFBB2EAA839 by thread 7.
    00:00:01.032: First chance exception 0xC00000FD (Stack Overflow) occurred in "c:\windows\system32\MSVCRT.DLL" at address 0x00007FFBB4C649FA by thread 1.
    00:00:01.032: Second chance exception 0xC00000FD (Stack Overflow) occurred in "c:\windows\system32\MSVCRT.DLL" at address 0x00007FFBB4C649FA by thread 1.

    We also tried using windeployqt.exe to make sure that no necessary dlls are missing, unfortunately with the same results.
    Any help would be greatly appreciated! Developement environment is as follows:

    Development Environment:
    Qt 5.12.2 using CMake 3.14
    Make Program: Ninja
    Compiler mingw 7.3.0 64-bit
    OS: Windows 10/7 64-bit


  • Lifetime Qt Champion



  • @Jsulm Thanks for the reply. However, this still does not seem to work, application does not start and no other messages are being displayed!


Log in to reply