在我的应用程序中包含 jpeg 插件
我制作了一个加载 jpeg 文件的 Qt GUI 应用程序。在我安装了 QtSDK (4.7.3) 的开发系统 (Win7) 上,它可以工作。 当我将应用程序和一些必需的 dll(如 QtGui4.dll 等)移动到另一个未安装 QtSDK 的系统时,程序会执行,但无法加载 jpeg。 我读到,我必须添加 jpeg 插件,但我不知道如何添加。
我已经在我的 main.cpp 中尝试过这个:
Q_IMPORT_PLUGIN(qjpeg);
以及我的项目文件中的这个:
QTPLUGIN += qjpeg
但我收到了错误:
cannot find -lqjpegd
我不关心我是否以动态或静态方式包含此插件。我只需要我的应用程序可以在其他系统上运行。我更喜欢更简单的方式。我尝试的是静态方式,对吗?我怎样才能将它作为 dll 文件包含在我的应用程序中? 我也检查了我的
mingw\plugins\imageformats
目录,确实没有qjpeg.dll。但有:
qjpeg4.dll qjpegd4.dll libqjpeg4.a
比我尝试过:
Q_IMPORT_PLUGIN(qjpeg4);
QTPLUGIN += qjpeg4
但得到了相同的错误消息。怎么了?
感谢您的回答!
I made a Qt GUI application that loads jpeg files. On my development system (Win7) where I have installed the QtSDK (4.7.3) it works.
When I move the application and some required dlls (like QtGui4.dll and others) to another system, where the QtSDK isnt installed, the program executes, but cant load jpegs.
I read, that i have to add the jpeg plugin, but I dont know how.
I already tried this in my main.cpp:
Q_IMPORT_PLUGIN(qjpeg);
together with this in my project file:
QTPLUGIN += qjpeg
But I got the error:
cannot find -lqjpegd
I dont care if I include this plugin in a dynamic or a static way. I just need my application to work on other systems. I prefer the way that is simpler. What I tried is the static way, right? How can I just include it as a dll file in my application ?
I also checked my
mingw\plugins\imageformats
directory and there is really no qjpeg.dll. But there are:
qjpeg4.dll
qjpegd4.dll
libqjpeg4.a
Than i tried it with:
Q_IMPORT_PLUGIN(qjpeg4);
QTPLUGIN += qjpeg4
But got the same error msg. Whats wrong?
Thanks for your answers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将
plugins\imageformats
文件夹复制到您的应用程序目录中。在你的 main() 中,添加这个
Copy the
plugins\imageformats
folder into your application directory.In your main(), add this