无法找到或加载Qt平台插件"windows"

Could not find or load the Qt platform plugin "windows"

本文关键字:平台 插件 Qt windows 加载      更新时间:2023-10-16

首先,为了防止重复报告,我尝试了这里,这里,这里,这里和这里给出的多种解决方案。

我使用Qt 5.5.1与Visual Studio 2012和开发我的应用程序在Windows 10 x64(不使用Qt Creator)。应用程序在发布模式下编译。

实际上,我的应用程序在我的PC上工作,没有任何问题,我的目录中唯一需要的库是:

Qt5Core.dll
Qt5Gui.dll
Qt5WinExtras.dll
Qt5Widgets.dll
Qt5Network.dll
msvcp110.dll
msvcr110.dll

现在,当我尝试在新安装的Windows 7 x86上启动我的应用程序时,我得到以下错误消息:

此应用程序无法启动,因为它无法找到或加载Qt平台插件"windows"。

重新安装应用程序可以解决这个问题。

现在我无法摆脱它。根据前面问的问题,这可能是qwindows.dll文件的问题(或者更准确地说,是应用程序无法找到它),首先,我像这样部署了我的发布目录:

[..]msvc2012bin>windeployqt.exe <PATH>

它已经生成了我的应用程序启动所需的所有文件,包括platforms/qwindows.dll,所以我只是简单地将它们全部复制到Windows 7目录而没有任何效果-错误仍然发生

我也尝试从msvc2012pluginsplatforms手动复制qwindows.dll -没有效果,

我做的最后一步是在Dependency Walker中检查我的应用程序-令人惊讶的是,没有qwindows.dll相关的依赖:

形象

所以我现在没有主意了,这里的问题是什么?

我在Windows下部署QOwnNotes (Qt5): https://github.com/pbek/QOwnNotes/blob/develop/appveyor.yml

# AppVeyor build configuration
# http://www.appveyor.com/docs/build-configuration
os: unstable
skip_tags: true
install:
- set QTDIR=C:Qt5.5mingw492_32
- set PATH=%PATH%;%QTDIR%bin;C:MinGWbin
- set RELEASE_PATH=appveyorrelease
before_build:
# getting submodules
- git submodule update --init
build_script:
# using a header file without MemoryBarrier, that causes the build to fail
- copy appveyorqopenglversionfunctions.h %QTDIR%includeQtGui
# workaround for MinGW bug
- sed -i s/_hypot/hypot/g c:mingwincludemath.h
- cd src
# we need to modify that to make it running on AppVeyor
- sed -i "s/CONFIG += c++11/QMAKE_CXXFLAGS += -std=gnu++0x/g" QOwnNotes.pro
- "echo #define RELEASE "AppVeyor" > release.h"
# setting the build number in the header file
- "echo #define BUILD %APPVEYOR_BUILD_NUMBER% > build_number.h"
- qmake QOwnNotes.pro -r -spec win32-g++
#  - qmake QOwnNotes.pro -r -spec win32-g++ "CONFIG+=debug"
- mingw32-make
# creating the release path
- md ..%RELEASE_PATH%
# copy the binary to our release path
- copy releaseQOwnNotes.exe ..%RELEASE_PATH%
# copy OpenSSL DLLs to the release path
- copy ..appveyorOpenSSLlibeay32.dll ..%RELEASE_PATH%
- copy ..appveyorOpenSSLlibssl32.dll ..%RELEASE_PATH%
- copy ..appveyorOpenSSLssleay32.dll ..%RELEASE_PATH%
# copy portable mode launcher to the release path
- copy ..appveyorQOwnNotesPortable.bat ..%RELEASE_PATH%
# copy translation files
- copy languages*.qm ..%RELEASE_PATH%
- cd ..%RELEASE_PATH%
# fetching dependencies of QT app
# http://doc.qt.io/qt-5/windows-deployment.html
- windeployqt --release QOwnNotes.exe
# this dll was missed by windeployqt
- copy ..libwinpthread-1.dll . /y
# this dll didn't work when released by windeployqt
- copy "..libstdc++-6.dll" . /y
# for some reason AppVeyor or windeployqt uses a copy of the German
# translation file as English one, which screws up the English user interface
- del "translationsqt_en.qm"
artifacts:
# pushing entire folder as a zip archive
- path: appveyorrelease
    name: QOwnNotes
deploy:
# Deploy to GitHub Releases
- provider: GitHub
    artifact: QOwnNotes
    draft: false
    prerelease: false
    auth_token:
    secure: spcyN/Dz3B2GXBPii8IywDLq6vfxC1SrN+xR2wMerFM7g2nTy0Lrh5agQONFoInR
    on:
    branch: master
notifications:
# Gitter webhook
- provider: Webhook
    url: https://webhooks.gitter.im/e/b6ef22402eb4af50f73a
    on_build_success: true
    on_build_failure: true
    on_build_status_changed: false