以QPA插件为例,windows下QPA插件为qwindows.dll,按qt说明需要放在platforms子目录下。
示例:相对于程序根目录。
1.
bin/my.exe
bin/Qt5Core.dll
bin/platforms/qwindows.dll
Qt官方说明结构,程序可运行。
2.
bin/my.exe
bin/a/b/c/Qt5Core.dll
bin/a/b/plugins/platforms/qwindows.dll
设置PATH变量为bin/a/b/c,让my.exe查找到Qt5Core.dll,程序可运行。
3.
bin/my.exe
bin/a/b/c/Qt5Core.dll
bin/a/b/platforms/qwindows.dll
去掉plugins目录包装,程序运行失败,没有加载Platform插件。
4.
bin/my.exe
bin/a/b/c/Qt5Core.dll
bin/a/plugins/platforms/qwindows.dll
plugins目录不在Qt5Core.dll上级,程序运行失败,没有加载Platform插件。
5.
bin/my.exe
bin/Qt5Core.dll
bin/../plugins/platforms/qwindows.dll
plugins目录放在bin上级目录,程序运行失败,没有加载Platform插件。
6.
bin/my.exe
bin/a/b/c/Qt5Core.dll
bin/a/b/c/plugins/platforms/qwindows.dll
plugins放在Qt5Core.dll同级,程序运行失败,没有加载Platform插件。