Reputation: 43
I am deploying our applications with needed DLLs in the same folder. plus qwindows.dll in platforms folder.
That works really great, also machines without any Qt installations.
Until yesterday, when I updated my Qt to 5.5.1. Now all applications which where once build with Qt 5.5.0 stopped working and are showing the well known error: "could not find or load the Qt platform plugin 'windows'".
When i rename my Qt folder (C:\Qt) to something else, everything works again.
Further investigation with Dependancy Walker showed that the applications indeed look into my C:\Qt folder to find the platforms dll. but they find a newer/different version and throw errors.
GetProcAddress(0xxxx [ADVAPI32.DLL], "SystemFunction036") called from "MSVCR120.DLL" at address 0xxxx and returned 0x00007FFB269C1050.
LoadLibraryW("C:\Qt\5.5\msvc2013_64\plugins\platforms\qwindows.dll") called from "QT5CORE.DLL" at address 0xxxx.
Loaded "QWINDOWS.DLL" at address 0xxxx. Successfully hooked module.
Loaded "WINMM.DLL" at address 0xxxx. Successfully hooked module.
Loaded "OLEAUT32.DLL" at address 0xxxx. Successfully hooked module.
Loaded "WINMMBASE.DLL" at address 0xxxx. Successfully hooked module.
Loaded "DEVOBJ.DLL" at address 0xxxx. Successfully hooked module.
Unloaded "QWINDOWS.DLL" at address 0xxxx.
Unloaded "OLEAUT32.DLL" at address 0xxxx.
Unloaded "WINMM.DLL" at address 0xxxx.
Unloaded "WINMMBASE.DLL" at address 0xxxx.
Unloaded "DEVOBJ.DLL" at address 0xxxx.
LoadLibraryW("C:\Qt\5.5\msvc2013_64\plugins\platforms\qwindows.dll") returned NULL. Error: Die angegebene Prozedur wurde nicht gefunden (127).
Now, if the C:\Qt folder is renamed, the application doesn't find it there and uses qwindows.dll in ./platforms/ like it always should.
Now the question is, is this behavior desired? Shouldn't it first search in the application directory, before searching somewhere else? Is there a possibility to change this behavior?
Upvotes: 0
Views: 2326
Reputation: 43
I found an answer that suits my needs.
there is a possibility to put a qt.conf file in the same directory as the deployed exe. In this file you can specify the plugins directory like this:
[Paths]
Plugins=.
This means that Qt will search for plugins only! in this folder. In this example the qwindows.dll needs to be in platforms/ like we are used to.
This works perfectly for me, because i have the qt dll's and plugins totally separated for each app i want to deploy. And the installed Qt versions don't interfere anymore.
A really detailed write-up can be found here: http://www.tripleboot.org/?p=536 in section "DLLs loaded by Qt itself a.k.a. plugins:"
Upvotes: 1
Reputation: 333
I found a solution. You need to add this environment variable and point to the qwindows.dll: QT_QPA_PLATFORM_PLUGIN_PATH=C:\Program Files\Your_App_Path\platforms
It working for me.
Upvotes: 0