I am developing a Qt 5.0 dekstop application using mingw47. I use QtMultimedia in this application to record and play audio. I have tested it for debug and it works. When I try to build it for release and run the executable file, I can't play the audio file that can normally be played in debug mode. I've added the following dlls before running the executable file:
我正在使用mingw47开发Qt 5.0 dekstop应用程序。我使用QtMultimedia这个应用程序录制和播放音频。我已经对它进行了调试测试,它是有效的。当我尝试为发布构建它并运行可执行文件时,我不能播放通常可以在调试模式下播放的音频文件。在运行可执行文件之前,我添加了以下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,
Qt5Multimedia.dll,
Qt5Network.dll,
Qt5Widgets.dll,
Qt5Xml.dll,
plugins/platforms/(all dlls),
plugins/mediaservice/(all dlls),
plugins/playlistformats(all dlls)
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,Qt5Multimedia。dll,Qt5Network。dll,Qt5Widgets。dll,Qt5Xml。dll、插件/平台/(所有dll)、插件/mediaservice/(所有dll)、插件/playlistformat(所有dll)
What is probably wrong? Or what other dlls am I missing?
可能是错误的呢?或者我还漏掉了什么其他的dll ?
3 个解决方案
#1
1
UPDATE: Use windeployqt.exe
! It works really well.
更新:使用windeployqt.exe !它工作得很好。
http://doc.qt.io/qt-5/windows-deployment.html#the-windows-deployment-tool
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的最简单方法是将Qt安装的bin目录(例如)添加到PATH变量中,然后运行:
windeployqt <path-to-app-binary>
While you are running your application in release mode (when it is working, ran from inside Qt Creator), execute depends.exe and point it at the application.
当您在发布模式下运行应用程序时(当它工作时,从Qt创建者内部运行),执行取决于。将它指向应用程序。
Make note of all the dlls that are referenced from your Qt folder.
注意从Qt文件夹中引用的所有dll。
Alternate way if you want to take more time with it:
如果你想多花点时间的话,可以换一种方式:
You can figure it out by hand by trying to delete files because Windows won't let you delete a folder or a dll while it is in use. So you could go and make a back up of your Qt installation, and then run you application, make sure it has connected to all the dll's it is going to use, and then try to delete folders and files in your Qt installation. Windows won't let you delete files that are in use by your release.
你可以通过删除文件来解决这个问题,因为Windows不允许你在使用文件夹或dll时删除它。你可以去备份你的Qt安装,然后运行你的应用,确保它已经连接到它将要使用的所有dll,然后尝试删除你的Qt安装中的文件夹和文件。Windows不允许你删除你的版本中使用的文件。
Also here is how Windows resolves dll's if you wanted to know:
如果你想知道的话,下面是Windows解析dll的方法:
http://msdn.microsoft.com/en-us/library/7d83bc18(v=vs.80).aspx
http://msdn.microsoft.com/en-us/library/7d83bc18(v = vs.80). aspx
EDIT: Also, you don't need to make the folder called plugins in your exe directory. It should be something like this:
编辑:同样,你不需要在你的exe目录中创建一个叫做plugins的文件夹。应该是这样的:
Qt 4.x:
Qt 4. x:
./myexe.exe
./QtCore.dll
./imageformats/qjpegd4.dll // Note: there isn't a "plugins" folder here
Qt 5.x: (take from here)
Qt 5。x:(从这里)
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
Also run qDebug() << QApplication::libraryPaths()
, and make note of paths that are searched for dlls on your computer.
还可以运行qDebug() < QApplication: libraryPaths(),并记录在计算机上搜索dll的路径。
Hope that helps.
希望有帮助。
#2
0
All of the DLL's in your list that have their import libraries linked to the application will be automatically loaded by the OS. If any of them are missing you will get a dialog telling you which DLL it failed to load. The only ones that look like they might be loaded manually by the application are the plugins. Make sure you are telling the QT multimedia system to load the them. Also make sure you check the error codes returned by the multiamedia manager.
所有链接到应用程序的导入库的DLL都将被操作系统自动加载。如果其中任何一个丢失了,您将会得到一个对话框,告诉您它没有加载哪个DLL。唯一看起来像是由应用程序手动加载的插件是插件。确保您正在告诉QT多媒体系统加载它们。还要确保检查multiamedia manager返回的错误代码。
Given your recent comment that the audio plays in debug mode but not in release mode is a good indication you have put the plugin DLL's in the wrong place. When you launch your application from Explorer or the command line the plugins
directory needs to be in the same directory as the application. Your directory structure should look something like below
鉴于您最近的评论,音频播放在调试模式,而不是在发布模式,这是一个很好的迹象,您把插件DLL放在了错误的地方。当您从资源管理器或命令行启动应用程序时,插件目录需要与应用程序位于同一个目录中。您的目录结构应该如下所示
c:\*\myprogram.exe
c:\*\plugins\platforms\(all dlls)
c:\*\plugins\mediaservice\(all dlls)
c:\*\plugins\playlistformats\(all dlls)
c:\*\D3D_Compiler_43.dll
c:\*\icudt49.dll
... other dll's here...
c:\*\Qt5Network.dll
c:\*\Qt5Widgets.dll
c:\*\Qt5Xml.dll
#3
0
I've found the answer. Now my application works. It can play audio file while running the executable file.
我已经找到了答案。现在我的申请工作。它可以在运行可执行文件时播放音频文件。
Although not listed in depends.exe, we should add the following dlls when using QMediaPlayer:
虽然没有列在依次中。exe,我们在使用QMediaPlayer时应该添加以下dll:
Qt5MultimediaWidgets
Qt5OpenGL
Qt5MultimediaWidgets Qt5OpenGL
Here is the reference: https://bugreports.qt-project.org/browse/QTBUG-30172
这里是引用:https://bugreports.qt-project.org/browse/QTBUG-30172
#1
1
UPDATE: Use windeployqt.exe
! It works really well.
更新:使用windeployqt.exe !它工作得很好。
http://doc.qt.io/qt-5/windows-deployment.html#the-windows-deployment-tool
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的最简单方法是将Qt安装的bin目录(例如)添加到PATH变量中,然后运行:
windeployqt <path-to-app-binary>
While you are running your application in release mode (when it is working, ran from inside Qt Creator), execute depends.exe and point it at the application.
当您在发布模式下运行应用程序时(当它工作时,从Qt创建者内部运行),执行取决于。将它指向应用程序。
Make note of all the dlls that are referenced from your Qt folder.
注意从Qt文件夹中引用的所有dll。
Alternate way if you want to take more time with it:
如果你想多花点时间的话,可以换一种方式:
You can figure it out by hand by trying to delete files because Windows won't let you delete a folder or a dll while it is in use. So you could go and make a back up of your Qt installation, and then run you application, make sure it has connected to all the dll's it is going to use, and then try to delete folders and files in your Qt installation. Windows won't let you delete files that are in use by your release.
你可以通过删除文件来解决这个问题,因为Windows不允许你在使用文件夹或dll时删除它。你可以去备份你的Qt安装,然后运行你的应用,确保它已经连接到它将要使用的所有dll,然后尝试删除你的Qt安装中的文件夹和文件。Windows不允许你删除你的版本中使用的文件。
Also here is how Windows resolves dll's if you wanted to know:
如果你想知道的话,下面是Windows解析dll的方法:
http://msdn.microsoft.com/en-us/library/7d83bc18(v=vs.80).aspx
http://msdn.microsoft.com/en-us/library/7d83bc18(v = vs.80). aspx
EDIT: Also, you don't need to make the folder called plugins in your exe directory. It should be something like this:
编辑:同样,你不需要在你的exe目录中创建一个叫做plugins的文件夹。应该是这样的:
Qt 4.x:
Qt 4. x:
./myexe.exe
./QtCore.dll
./imageformats/qjpegd4.dll // Note: there isn't a "plugins" folder here
Qt 5.x: (take from here)
Qt 5。x:(从这里)
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
Also run qDebug() << QApplication::libraryPaths()
, and make note of paths that are searched for dlls on your computer.
还可以运行qDebug() < QApplication: libraryPaths(),并记录在计算机上搜索dll的路径。
Hope that helps.
希望有帮助。
#2
0
All of the DLL's in your list that have their import libraries linked to the application will be automatically loaded by the OS. If any of them are missing you will get a dialog telling you which DLL it failed to load. The only ones that look like they might be loaded manually by the application are the plugins. Make sure you are telling the QT multimedia system to load the them. Also make sure you check the error codes returned by the multiamedia manager.
所有链接到应用程序的导入库的DLL都将被操作系统自动加载。如果其中任何一个丢失了,您将会得到一个对话框,告诉您它没有加载哪个DLL。唯一看起来像是由应用程序手动加载的插件是插件。确保您正在告诉QT多媒体系统加载它们。还要确保检查multiamedia manager返回的错误代码。
Given your recent comment that the audio plays in debug mode but not in release mode is a good indication you have put the plugin DLL's in the wrong place. When you launch your application from Explorer or the command line the plugins
directory needs to be in the same directory as the application. Your directory structure should look something like below
鉴于您最近的评论,音频播放在调试模式,而不是在发布模式,这是一个很好的迹象,您把插件DLL放在了错误的地方。当您从资源管理器或命令行启动应用程序时,插件目录需要与应用程序位于同一个目录中。您的目录结构应该如下所示
c:\*\myprogram.exe
c:\*\plugins\platforms\(all dlls)
c:\*\plugins\mediaservice\(all dlls)
c:\*\plugins\playlistformats\(all dlls)
c:\*\D3D_Compiler_43.dll
c:\*\icudt49.dll
... other dll's here...
c:\*\Qt5Network.dll
c:\*\Qt5Widgets.dll
c:\*\Qt5Xml.dll
#3
0
I've found the answer. Now my application works. It can play audio file while running the executable file.
我已经找到了答案。现在我的申请工作。它可以在运行可执行文件时播放音频文件。
Although not listed in depends.exe, we should add the following dlls when using QMediaPlayer:
虽然没有列在依次中。exe,我们在使用QMediaPlayer时应该添加以下dll:
Qt5MultimediaWidgets
Qt5OpenGL
Qt5MultimediaWidgets Qt5OpenGL
Here is the reference: https://bugreports.qt-project.org/browse/QTBUG-30172
这里是引用:https://bugreports.qt-project.org/browse/QTBUG-30172