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!
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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With