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

时间:2016-10-19 20:53:03

标签: c++ windows visual-studio qt dll

首先,为了防止重复报告,我尝试了hereherehereherehere多个解决方案。

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

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

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

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

  

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

     

重新安装应用程序可能会解决此问题。

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

[..]\msvc2012\bin>windeployqt.exe <PATH>

它生成了我的应用程序启动所需的所有文件,包括platforms/qwindows.dll所以我只是将它们全部复制到Windows 7目录而没有任何影响 - 错误仍然存​​在。

我还尝试从qwindows.dll手动复制msvc2012\plugins\platforms - 没有效果,

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

image

所以我现在没有想法,这里有什么问题?

1 个答案:

答案 0 :(得分:0)

这是我在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:\Qt\5.5\mingw492_32
- set PATH=%PATH%;%QTDIR%\bin;C:\MinGW\bin
- set RELEASE_PATH=appveyor\release

before_build:
# getting submodules
- git submodule update --init

build_script:
# using a header file without MemoryBarrier, that causes the build to fail
- copy appveyor\qopenglversionfunctions.h %QTDIR%\include\QtGui
# workaround for MinGW bug
- sed -i s/_hypot/hypot/g c:\mingw\include\math.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 release\QOwnNotes.exe ..\%RELEASE_PATH%
# copy OpenSSL DLLs to the release path
- copy ..\appveyor\OpenSSL\libeay32.dll ..\%RELEASE_PATH%
- copy ..\appveyor\OpenSSL\libssl32.dll ..\%RELEASE_PATH%
- copy ..\appveyor\OpenSSL\ssleay32.dll ..\%RELEASE_PATH%
# copy portable mode launcher to the release path
- copy ..\appveyor\QOwnNotesPortable.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 "translations\qt_en.qm"

artifacts:
# pushing entire folder as a zip archive
- path: appveyor\release
    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

我希望这有点帮助...