WinDeployqt 不会为调试应用程序部署 Qwindowsd.dll
windeployqt doesn't deploy qwindowsd.dll for a debug application
>我正在尝试使用windeployqt.exe
(Qt 5.13.2(为CMake 3.16生成的调试应用程序部署dll。除平台插件 dll 外,所有 dll 都已正确部署,它部署qwindows.dll
而不是qwindowsd.dll
,并在我尝试运行可执行文件时导致以下错误:
此应用程序无法启动,因为无法初始化Qt平台插件。
到目前为止,我已经尝试过:
- 在
windeployqt
命令行上指定--debug
。失败了,因为找不到Qt5Coredd.dll
(注意双 d(。 - 验证是否未设置与Qt插件相关的环境变量。
- 已检查
PATH
以确保它不包含任何具有platforms
目录的文件夹。
如果我手动复制qwindowsd.dll
,一切正常。但是我真的很想弄清楚我做错了什么windeployqt
.
这显然是一个已知的问题,Qt在修复时拖了后腿,但我在CMake中找到了解决方法 - 这适用于Ninja生成器/Visual Studio的内置CMake支持以及常规的Visual Studio解决方案生成器
# Split windeployqt into 2 parts to fix issue with deploying debug plugins
add_custom_command(TARGET MyApp POST_BUILD
COMMAND ${QT_PATH}/bin/windeployqt --compiler-runtime --no-plugins ${MY_APP_EXE})
if (CMAKE_GENERATOR STREQUAL "Ninja")
# Ninja is a single-config generator so we can use CMAKE_BUILD_TYPE to generate different commands
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_custom_command(TARGET MyApp POST_BUILD
COMMAND ${QT_PATH}/bin/windeployqt --debug --no-compiler-runtime --no-translations --no-libraries ${MY_APP_EXE})
else()
add_custom_command(TARGET MyApp POST_BUILD
COMMAND ${QT_PATH}/bin/windeployqt --release --no-compiler-runtime --no-translations --no-libraries ${MY_APP_EXE})
endif()
else()
# if in MSVC we have to check the configuration at runtime instead of generating different commands
add_custom_command(TARGET MyApp POST_BUILD
COMMAND cmd.exe /c if "$(Configuration)" == "Debug" ${QT_PATH}/bin/windeployqt --debug --no-compiler-runtime --no-translations --no-libraries ${MY_APP_EXE})
add_custom_command(TARGET MyApp POST_BUILD
COMMAND cmd.exe /c if not "$(Configuration)" == "Debug" ${QT_PATH}/bin/windeployqt --release --no-compiler-runtime --no-translations --no-libraries ${MY_APP_EXE})
endif()
我在使用 Conan 2.0 和 CMakeToolchain 和CMakeDeps生成器时遇到了这个问题。我正在运行conan install .. --output-folder=. -b missing -s build_type=Debug
并使用CMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
.使用默认的 Conan 配置文件,这将在调试模式下创建一个可执行文件,该可执行文件与发布VC 运行时链接。
要解决此问题,您可以为指定compiler.runtime_type=Debug
的调试版本创建新的配置文件,也可以使用-s compiler.runtime_type=Debug
运行conan install
。
相关文章:
- 使用调试/崩溃报告将应用程序部署到客户端
- 使用 mod_gsoap 部署服务时,如何在 Gsoap 中更改 soap 上下文的模式?
- Qt QML相机在部署后显示白屏
- WinDeployqt 不会为调试应用程序部署 Qwindowsd.dll
- 在 Linux 上部署 Qt 应用程序
- 如何使用所有依赖项部署C++项目?
- 更改用于部署的凭据提供程序 GUID 的过程
- 由于____chkstk_darwin,在Catalina上使用部署10.10编译的MacOS应用程序在HighSierra版本<崩溃
- Qt5 部署"procedure entry point could not be located"
- 用 Python 训练神经网络并在 C++ 中部署
- 部署在张量流中训练的神经网络来火炬C++的最佳方法是什么?
- 部署基于 qt 的项目后,我的 sqlite3 文件不会被复制 (android)
- Qt-png图像未显示在部署应用程序中
- 从Windows 10编译VS2017在Windows 7和…上部署..找不到DLL
- 如何部署C++DLL
- 使用静态 Qt 构建在 Linux 上部署 Qt5 应用程序
- Windows 上的 KDE 框架部署
- QT QML:使用.qrc文件将SQLite数据库部署到Android不起作用
- CMAKE+QT MAC 如何设置部署目标?
- Java JNI GDAL 本机库在重新部署为 Web 应用程序时出现类加载器错误