Solved Link problem - imageformats plugins not found
-
Hello,
I have received an application code that was written in 2010 on QT 4.6.2.
I am new to Qt and have downloaded Qt 5.7 from Qt site.When linking the application, I get a failure, the first 3 messages are:
./debug\main.o: In function
ZN25StaticqjpegPluginInstanceC1Ev': C:\RDF\build-RDF-Desktop_Qt_5_7_0_MinGW_32bit-Debug/../RDF/main.cpp:34: undefined reference to
qt_static_plugin_qjpeg()'
./debug\main.o: In functionZN24StaticqgifPluginInstanceC1Ev': C:\RDF\build-RDF-Desktop_Qt_5_7_0_MinGW_32bit-Debug/../RDF/main.cpp:35: undefined reference to
qt_static_plugin_qgif()'
./debug\main.o: In functionZN29StaticqkrcodecsPluginInstanceC1Ev': C:\RDF\build-RDF-Desktop_Qt_5_7_0_MinGW_32bit-Debug/../RDF/main.cpp:36: undefined reference to
qt_static_plugin_qkrcodecs()'I understand that the linker could not find the plugins: qjpeg, qgif, qkrcodecs.
In the .pro file, the instructions are:
TEMPLATE = app
QT += svg
TARGET = RDFSOURCES += main.cpp
mainwindow.cpp
....
simulprogressdialog.cppHEADERS += mainwindow.h
....
simulprogressdialog.hCONFIG += static
FORMS += mainwindow.ui
savedialog.uiRESOURCES += application.qrc
RC_FILE = logo.rc
INCLUDEPATH =
.
./../../Qwt-6.1.3/src
C:\Qt\5.7\mingw53_32\include\QtWidgets
C:\Qt\5.7\mingw53_32\include\QtPrintSupportLIBS += -LC:/Qwt-6.1.3/lib -lqwt
-LC:\RDF\RDF\gsl\lib -lgsl -lgslcblas
-LC:\Qt\5.7\mingw53_32\plugins\imageformatsQTPLUGIN += qjpeg
qgif
qkrcodecs
The main.cpp file has the lines:
Q_IMPORT_PLUGIN(qjpeg)
Q_IMPORT_PLUGIN(qgif)
Q_IMPORT_PLUGIN(qkrcodecs)I opened the generated MakeFile.Debug file and found that the LIBS directive
is as follows (I have split it into few lines):LIBS =
-lmingw32
-LC:\Qt\5.7\mingw53_32\lib
C:\Qt\5.7\mingw53_32\lib\libqtmaind.a
-LC:\utils\postgresql\pgsql\lib
-LC:\utils\my_sql\my_sql\lib
-lshell32
-LC:\Qwt-6.1.3\lib -lqwt
-LC:\RDF\RDF\gsl\lib -lgsl -lgslcblas
-LC:\Qt\5.7\mingw53_32\plugins\imageformats
C:\Qt\5.7\mingw53_32\lib\libQt5Svgd.a
C:\Qt\5.7\mingw53_32\lib\libQt5Widgetsd.a
C:\Qt\5.7\mingw53_32\lib\libQt5Guid.a
C:\Qt\5.7\mingw53_32\lib\libQt5Cored.a
debug\logo_res.oI see that the generated Makefile took the path to the Qwt & GSL libraries, it also
took the path to the plugins directory, BUT it did not take the QTPLUGIN directive
from the .pro file and hence did not find the plugins.I also see two lines starting with "-LC:\utils..." which point to a directory
that does not exists on my computer. I do not know where those lines came from.I do not understand what is wrong in the .pro file or in my environment, and why
the link process does not find the plugins.
Any help will be very appreciated.
Rivka -
Hi and welcome to devnet,
The .pro file is written to be used with a static Qt version. Remove the Q_IMPORT_PLUGIN statements and the QTPLUGIN and you should be able to go further.
-
Hi and welcome to devnet,
The .pro file is written to be used with a static Qt version. Remove the Q_IMPORT_PLUGIN statements and the QTPLUGIN and you should be able to go further.
-
Thank you, that did solve the link problem.