dll qt 相对路径,Qt5应用程序部署qwindows.dll搜索路径顺序

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?

解决方案

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:"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值