gpt4 book ai didi

c++ - 在 Release模式下使用 QtMultimedia 部署 Qt 应用程序

转载 作者:行者123 更新时间:2023-11-28 07:39:13 26 4
gpt4 key购买 nike

我正在使用 mingw47 开发 Qt 5.0 dekstop 应用程序。我在此应用程序中使用 QtMultimedia 来录制和播放音频。我已经对它进行了调试测试,它可以工作。当我尝试为发布构建它并运行可执行文件时,我无法播放通常可以在 Debug模式下播放的音频文件。我在运行可执行文件之前添加了以下 dll:

D3D_Compiler_43.dll,
icudt49.dll,
icuin49.dll,
icuuc49.dll,
libEGL.dll,
libgcc_s_sjlj-1.dll,
libGLESv2.dll,
liblibmpeg2_plugin.dll,
libstdc++-6.dll,
libwinpthread-1.dll,
Qt5Core.dll,
Qt5Gui.dll,
Qt5多媒体.dll,
Qt5Network.dll,
Qt5Widgets.dll,
Qt5Xml.dll,
插件/平台/(所有 dll),
插件/媒体服务/(所有 dll),
插件/播放列表格式(所有 dll)

可能是哪里出了问题?或者我还缺少哪些其他 dll?

最佳答案

更新:使用 windeployqt.exe !效果非常好。

http://doc.qt.io/qt-5/windows-deployment.html#the-windows-deployment-tool

The simplest way to use windeployqt is to add the bin directory of your Qt installation (e.g. ) to the PATH variable and then run:

windeployqt <path-to-app-binary>

当您在 Release模式下运行您的应用程序时(当它工作时,从 Qt Creator 内部运行),执行 depends.exe并将其指向应用程序。

记下从您的 Qt 文件夹中引用的所有 dll。

如果你想花更多时间使用它的替代方法:

您可以通过尝试删除文件来手动解决这个问题,因为 Windows 不允许您删除正在使用的文件夹或 dll。所以你可以去备份你的 Qt 安装,然后运行你的应用程序,确保它已经连接到它要使用的所有 dll,然后尝试删除你的 Qt 安装中的文件夹和文件。 Windows 不允许您删除您的版本正在使用的文件。

如果您想知道,这里还有 Windows 是如何解析 dll 的:

http://msdn.microsoft.com/en-us/library/7d83bc18(v=vs.80).aspx

编辑:另外,您不需要在 exe 目录中创建名为 plugins 的文件夹。它应该是这样的:

Qt 4.x:

./myexe.exe
./QtCore.dll
./imageformats/qjpegd4.dll // Note: there isn't a "plugins" folder here

Qt 5.x:(取自 here)

The executable                   ./plugandpaint.exe
The Basic Tools plugin ./plugins/pnp_basictools.dll
The ExtraFilters plugin ./plugins/pnp_extrafilters.dll
The Qt Windows platform plugin ./platforms/qwindows.dll
The Qt Core module ./Qt5Core.dll
The Qt GUI module ./Qt5Gui.dll
The Qt Widgets module ./Qt5Widgets.dll

同时运行 qDebug() << QApplication::libraryPaths() , 并记下 paths在您的计算机上搜索 dll。

希望对您有所帮助。

关于c++ - 在 Release模式下使用 QtMultimedia 部署 Qt 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16160586/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com