在我的应用程序中包含jpeg插件 [英] include the jpeg plugin in my application

查看:138
本文介绍了在我的应用程序中包含jpeg插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个加载jpeg文件的Qt GUI应用程序.在我安装了QtSDK(4.7.3)的开发系统(Win7)上,它可以正常工作. 当我将应用程序和一些必需的dll(例如QtGui4.dll等)移动到未安装QtSDK的另一个系统时,该程序将执行,但无法加载jpeg. 我读到,我必须添加jpeg插件,但我不知道如何.

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.

我已经在main.cpp中尝试过此操作:

I already tried this in my main.cpp:

Q_IMPORT_PLUGIN(qjpeg);

与此一起在我的项目文件中:

together with this in my project file:

QTPLUGIN += qjpeg

但是我得到了错误:

cannot find -lqjpegd

我不在乎我是否以动态或静态方式包含此插件.我只需要我的应用程序即可在其他系统上工作.我更喜欢这种简单的方法.我尝试过的是静态方式,对吗?我如何才能将其作为dll文件包含在我的应用程序中? 我还检查了我的

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

目录,实际上没有qjpeg.dll.但是有:

directory and there is really no qjpeg.dll. But there are:

qjpeg4.dll qjpegd4.dll libqjpeg4.a

qjpeg4.dll qjpegd4.dll libqjpeg4.a

比我尝试过:

Q_IMPORT_PLUGIN(qjpeg4);
QTPLUGIN += qjpeg4

但是出现了相同的错误味精.怎么了?

But got the same error msg. Whats wrong?

感谢您的回答!

推荐答案

plugins\imageformats文件夹复制到您的应用程序目录中. 在您的main()中,添加此

Copy the plugins\imageformats folder into your application directory. In your main(), add this

QApplication a(argc, argv);
QString sDir = QCoreApplication::applicationDirPath();
a.addLibraryPath(sDir+"/plugins");

这篇关于在我的应用程序中包含jpeg插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆