Deployment issue - Could not find or load the Qt Platform plugin "windows"

  • Hello,

    I'm having issues deploying an application using the Quick and Dirty Deployment guide. The app compiles and runs fine in the debugger, but when I copy the exe into the deployment folder along with all of the folders/dlls from the plugins and bin folders I am getting this error message: Could not find or load the Qt Platform plugin "windows"

    Here is the deployment folder: deployment folder

    When I change the Qt installation folder from C:\Qt to C:\QtHidden, the app will not attempt to load qwindows.dll from the Deployent\platforms folder. It seems that the app is still trying to load the qwindows.dll from the Qt installation folder. So I tried using the qt.conf file to specify that the plugins folder is in the working directory, which didn't fix the problem: qt.conf

    Also, there is no source code in the application that specifies where to find the dll's, so it should have the default behavior. I should also mention that this deployment issue just started happening after I implemented a feature in the application that used QMediaPlayer. Before that, everything was working fine. Please let me know if you need more info.

    Any help would be appreciated, thanks!

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    A good tool to help deployment is windeployqt, it should pull in everything you need

  • @SGaist Hello, and thank you for your response. I tried windeployqt and it did not solve the problem unfortunately.

  • Lifetime Qt Champion

    Did you call it in a clean build of your application ?

  • Moderators

    Hi @alex1,

    Please follow SGaist's suggestion to do a clean build. If that still doesn't work, please tell us the following to help with the diagnosis:

    1. How many versions of Qt do you have installed? What are they?
    2. Did you upgrade Qt recently (after your last successful deployment)?
    3. What is the full path to to folder that you got the DLLs from?
    4. What happens if you revert your code to an old version (before you added QMediaPlayer)? Does it still deploy correctly?

  • I just tried it with a clean build of the application and it did not work.

    1. I have two versions of Qt installed, Qt 5.3.0 and Qt 5.3.2. The build kit for 5.3.0 was used for the app. I tried building/running windeploy after deleting the 5.3.2 folder to make sure 5.3.0 was the only version installed but that didn't fix the problem.
    2. I didn't upgrade recently
    3. C:\Qt\Qt5.3.0\5.3\mingw482_32\bin

    Maybe if I completely uninstall Qt and then install qt 5.3.0?

  • Moderators

    @alex1 said:

    Maybe if I completely uninstall Qt and then install qt 5.3.0?

    It's worth trying. From your answers, I can't really see what's causing the problems.

    Does your app run correctly if you launch it from Qt Creator? If so, you can use ListDLLs to see exactly which DLLs your app has loaded.

    By the way, Qt 5.3.2 is a bugfix + stability release, designed to completely replace Qt 5.3.0. May I ask why you want to use Qt 5.3.0 instead of 5.3.2?

  • OK, I removed all Qt installations from my computer and qt creator and installed Qt 5.5.0 mingw 32 bit. I removed the QMediaPlayer stuff and then used windeploy.exe on a clean build it worked fine. Then I added the QMediaPlayer stuff and same result with the windows platform plugin error. Since I'm able to run it in the debugger in release mode, I ran ListDLLs on it and checked to make sure every dll that is uses that is not in any windows system folder is present in the deployment folder, but that still didn't fix the problem. Not sure what to do next, any other ideas?

    update: I can run it from the deployment folder, but if I rename C:\Qt to C:\QtHidden it will crash with the windows platform error. Heres a screenshot of the deployment folder: The folder was built with windeploy.exe

    update: I found a solution. If I add QT_PLUGIN_PATH to system environment variables and set it to "." then it works. I'd prefer not to use this solution.

  • This post is deleted!

  • Lifetime Qt Champion

    You can use a qt.conf file for that in your application folder however that doesn't explain why when using a multimedia widget your application fails.

  • Lifetime Qt Champion

    Aren't you missing the QtMultimediaWidgets library ?

  • Are you supplying the qwindows.dll from $QTDIR/plugins/platforms?

    Path has to be:

    There was a bug in some early 5.x versions if i recall correctly, which was looking for the dll in the $QTDIR-path instead of local deployment. ~ "qwindows.dll"

    Edit: I should definitly do not jump to the end of the discussion if most things have been answered....

  • @NetZwerg
    I am supplying the qwindows.dll from $QTDIR/plugins/platforms
    It must be the Qt bug because I have the deployment folder structure correct. If I set the plugins path using QT_PLUGIN_PATH = . then it works. It must be still trying to look for the qwindows.dll in the Qt install folder. So far the only solution I have is to set QT_PLUGIN_PATH. I tried qt.conf in the working directory and it didn't work. I put this in qt.conf:

    Plugins = .

  • @SGaist I ran windeploy.exe after installing qt 5.5.0 and it didn't need QtMultimediaWidgets.dll

  • I just ended up using the QT_PLUGIN_PATH variable, thanks for the help everyone.

  • You should also define the 'Prefix'. It would be something like 'Prefix = /path/to/the/root/of/your/qt/install'

Log in to reply

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