Not launch Qt application on Windows.



  • I am developing a desktop software using Qt.
    The main problem uses "QApplication" while it only uses "Core" plugin.
    I did so because I plan to use "Widget" plugin in the future.

    The problem that happened to me is, seemingly, a common problem.
    When I try to launch the application, the following error messages are displayed.

    This application failed to start because it could not find or load the Qt platform plugin "windows". in "C:\Qt\5.9.1\msvc2017_64\plugins\platforms"

    As I googled it this problem, the most solution says, the environment path QT_QPA_PLATFORM_PLUGIN_PATH properly.

    As shown in the last error message, I set this environment path to C:\Qt\5.9.1\msvc2017_64\plugins\platforms. However, as the error message indicates, the problem was not resolved (I checked qwindows.dll exists in the above QPA path).

    The development environment that I use is listed below.

    OS: Windows 8 Home Edition (64bit)
    Qt: Qt 5.9.1 (I also tested 5.9 and 5.8, but the same problem occurred)
    Compiler: MSVC C++ Compiler 2017 (x64)

    If anyone experienced the same or similar problem, could you please tell me the solution?
    Thank you in advance for your help.


  • Moderators

    @tatsy said in Not launch Qt application on Windows.:

    As I googled it this problem, the most solution says, the environment path QT_QPA_PLATFORM_PLUGIN_PATH properly.
    As shown in the last error message, I set this environment path to C:\Qt\5.9.1\msvc2017_64\plugins\platforms.

    set it to the plugins folder, instead of the platforms folder.

    Also did you read this?



  • Hi @raven-worx

    Thank you very much for the reply.

    Yes, I read that post, and I also tested to set the QT_QPA_..._PATH to the plugin folder, instead of the platform folder.

    To avoid any misunderstandings, I tested it again now, but the problem was not solved.

    Anyway, thank you very much for your advice.


  • Moderators

    @tatsy said in Not launch Qt application on Windows.:

    Yes, I read that post

    there are many other possible solutions.
    The easiest is to use windeployqt tool



  • Actually, I compile the program on a computer and run the program on that computer (without deployment).

    Also in this case, does the solution to use windeployqt tool work?

    What was strange was that it originally ran on that computer and it suddenly got not to work.

    I tested the same program on the different computer (Win10 64bit), it properly worked.

    Do you have any idea?


  • Moderators

    @tatsy said in Not launch Qt application on Windows.:

    Also in this case, does the solution to use windeployqt tool work?

    all the tool does is to copy the needed libs to the exe. Since the default paths to look for libs is the folder of the exe it will work everywhere without setting any env variables etc.
    I think the VC runtime libs are not copied. But you would notice this with a different error.



  • Hi @raven-worx,

    I tested windeployqt.exe and the problem was fiexed.
    So, this means that this kind of Qt programs depend on many other env. paths other than QT_QPA_..._PATH?

    At any rate, thank you very much for your help.
    (to be honest, this problem has annoyed to me for a couple of days...)


  • Moderators

    @tatsy said in Not launch Qt application on Windows.:

    So, this means that this kind of Qt programs depend on many other env. paths other than QT_QPA_..._PATH?

    Not necessarily env variables. The env variables are jsut a way to quickly add some paths without recompiling the application.
    In the link i've posted, at the very bottom you can see methods to set the paths to searching for plugins via code


Log in to reply
 

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