Include jpeg plugin in my application

I made a Qt GUI application that downloads jpeg files. On my development system (Win7), where I installed QtSDK (4.7.3), it works. When I move the application and some necessary DLLs (for example, QtGui4.dll and others) to another system where QtSDK is not installed, the program executes, but does not support jpeg. I read that I need to add a jpeg plugin, but I don't know how to do it.

I already tried this in my main.cpp:

Q_IMPORT_PLUGIN(qjpeg); 

along with this in the project file:

 QTPLUGIN += qjpeg 

But I got the error:

 cannot find -lqjpegd 

I don’t like it if I enable this plugin in a dynamic or static way. I just need my application to work on other systems. I prefer what is simpler. What I tried is a static way, right? How can I just include it in a dll file in my application? I also checked mine

 mingw\plugins\imageformats 

and actually there is no qjpeg.dll. But there are:

qjpeg4.dll qjpegd4.dll libqjpeg4.a

What I tried:

 Q_IMPORT_PLUGIN(qjpeg4); QTPLUGIN += qjpeg4 

But got the same msg error. What's wrong?

Thank you for your responses!

+6
source share
1 answer

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

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

Source: https://habr.com/ru/post/892938/


All Articles