使用windeployqt的发布版本中的“未安装模块QtQuick”错误

时间:2018-09-19 19:35:58

标签: visual-studio qt qt5 qt-creator qtquick2

我有一个简单的Qt 5.11 x64项目,MSVC 2017编译器,具有由Qt Creator 4.7创建的默认构建设置。

它工作正常,但是当我添加windeployqt用于复制Release版本中的所有Qt dll时,我得到了错误(从Qt Creator运行)

QQmlApplicationEngine failed to load component
qrc:/qml/main.qml:1 module "QtQuick" is not installed

QML文件具有

import QtQuick 2.7

.pro

QT += quick widgets xml
CONFIG += c++11

CONFIG += precompile_header
PRECOMPILED_HEADER = stdafx.h

CONFIG -=  embed_manifest_exe
RC_FILE = app-uac.rc


DEFINES += QT_DEPRECATED_WARNINGS

DESTDIR=bin

SOURCES += main.cpp \
    ..........

RESOURCES += qml.qrc \
    img.qrc \
    font.qrc

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

HEADERS += \
    .........
    stdafx.h

OTHER_FILES += \
    app-uac.exe.manifest \
    app-uac.rc \
    app_info.xml

LIBS += -L"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.17134.0/um/x64/" -lUser32 -lAdvAPI32

TARGET_CUSTOM_EXT = .exe

CONFIG(release, debug|release) {
    DEPLOY_COMMAND = $$[QT_INSTALL_BINS]/windeployqt --release --compiler-runtime

    DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/$${DESTDIR}/$${TARGET}$${TARGET_CUSTOM_EXT}))

    QMAKE_POST_LINK += $${DEPLOY_COMMAND} $${DEPLOY_TARGET}
}

windeployqt输出

    C:/Qt/Qt5.11/5.11.1/msvc2017_64/bin/windeployqt --release --compiler-runtime C:\Users\.......-Release\bin\App.exe
C:\Users\.....-Release\bin\App.exe 64 bit, release executable [QML]
Adding Qt5Svg for qsvgicon.dll
Direct dependencies: Qt5Core Qt5Gui Qt5Qml Qt5Quick Qt5Widgets Qt5Xml
All dependencies   : Qt5Core Qt5Gui Qt5Network Qt5Qml Qt5Quick Qt5Widgets Qt5Xml
To be deployed     : Qt5Core Qt5Gui Qt5Network Qt5Qml Qt5Quick Qt5Svg Qt5Widgets Qt5Xml
Updating Qt5Core.dll.
Updating Qt5Gui.dll.
Updating Qt5Network.dll.
Updating Qt5Qml.dll.
Updating Qt5Quick.dll.
Updating Qt5Svg.dll.
Updating Qt5Widgets.dll.
Updating Qt5Xml.dll.
Updating libGLESV2.dll.
Updating libEGL.dll.
Updating d3dcompiler_47.dll.
Updating opengl32sw.dll.
Updating vc_redist.x64.exe.
Patching Qt5Core.dll...
Creating directory C:/.......-Release/bin/bearer.
Updating qgenericbearer.dll.
Creating directory C:/........-Release/bin/iconengines.
Updating qsvgicon.dll.
Creating directory C:/........-Release/bin/imageformats.
Updating qgif.dll.
Updating qicns.dll.
Updating qico.dll.
Updating qjpeg.dll.
Updating qsvg.dll.
Updating qtga.dll.
Updating qtiff.dll.
Updating qwbmp.dll.
Updating qwebp.dll.
Creating directory C:/.......-Release/bin/platforms.
Updating qwindows.dll.
Creating directory C:/......-Release/bin/qmltooling.
Updating qmldbg_debugger.dll.
Updating qmldbg_inspector.dll.
Updating qmldbg_local.dll.
Updating qmldbg_messages.dll.
Updating qmldbg_native.dll.
Updating qmldbg_nativedebugger.dll.
Updating qmldbg_profiler.dll.
Updating qmldbg_quickprofiler.dll.
Updating qmldbg_server.dll.
Updating qmldbg_tcp.dll.
Creating directory C:/Users/......-Release/bin/scenegraph.
Updating qsgd3d12backend.dll.
Creating directory C:/Users/.......-Release/bin/styles.
Updating qwindowsvistastyle.dll.
Creating C:\.......-Release\bin\translations...
Creating qt_ar.qm...
Creating qt_bg.qm...
Creating qt_ca.qm...
Creating qt_cs.qm...
Creating qt_da.qm...
Creating qt_de.qm...
Creating qt_en.qm...
Creating qt_es.qm...
Creating qt_fi.qm...
Creating qt_fr.qm...
Creating qt_gd.qm...
Creating qt_he.qm...
Creating qt_hu.qm...
Creating qt_it.qm...
Creating qt_ja.qm...
Creating qt_ko.qm...
Creating qt_lv.qm...
Creating qt_pl.qm...
Creating qt_ru.qm...
Creating qt_sk.qm...
Creating qt_uk.qm...

1 个答案:

答案 0 :(得分:1)

看起来可以与--qmldir参数一起使用。

$$[QT_INSTALL_BINS]/windeployqt --release --compiler-runtime  --qmldir $$shell_quote($$shell_path($$PWD/qml))