QImageIOPlugin doesn't work
-
I get this error on startup:
"The plugin 'E:/Qt/5.12.2/msvc2017/plugins/imageformats/textimage1.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin QFactoryLoader::QFactoryLoader() checking directory path "E:/Cpp_Projekte/QT/Foundations_of_QT/CH11_image_plugin/read/build-read-Desktop_Qt_5_12_2_MSVC2017_32bit-Debug/debug/imageformats" ... loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qgifd.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qicnsd.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qicod.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qjpegd.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qsvgd.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qtgad.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qtiffd.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qwbmpd.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qwebpd.dll"
I build the plugin and the project with MSVC2017 32 Bit Debug to get the Debug Output. There should not be a mix?
The output of the plugin file looks like this:
22:57:44: Running steps for project image_plugin... 22:57:44: Configuration unchanged, skipping qmake step. 22:57:44: Starting: "E:\Qt\Tools\QtCreator\bin\jom.exe" install E:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release install copy /y release\textimage1.dll E:\Qt\5.12.2\msvc2017\plugins\imageformats\textimage1.dll 1 Datei(en) kopiert. 22:57:44: The process "E:\Qt\Tools\QtCreator\bin\jom.exe" exited normally. 22:57:44: Elapsed time: 00:00.
-
@sandro4912 said in QImageIOPlugin doesn't work:
copy /y release\textimage1.dll E:\Qt\5.12.2\msvc2017\plugins\imageformats\textimage1.dll
This does not look like a debug build.
-
Your plugin is named:
textimage1.dll
It is missing the d suffix for your debug build.You can use
TARGET = $$qtLibraryTarget(textimage)
-
Than i wonder why it is not build as debug.
I clearly select debug and then build:
The build settings for debug:
I already removed the
release
flag fromCONFIG
so it should not get forced into release or should it?TEMPLATE = lib CONFIG += plugin TARGET = $$qtLibraryTarget(textimage) VERSION = 1.0.0 HEADERS += \ textimagehandler.h \ textimageplugin.h SOURCES += \ textimagehandler.cpp \ textimageplugin.cpp target.path += $$[QT_INSTALL_PLUGINS]/imageformats INSTALLS += target DISTFILES += \ textimageplugin.json
What does
TARGET = $$qtLibraryTarget(textimage)
do? why is it needed? -
Than i wonder why it is not build as debug.
I clearly select debug and then build:
The build settings for debug:
I already removed the
release
flag fromCONFIG
so it should not get forced into release or should it?TEMPLATE = lib CONFIG += plugin TARGET = $$qtLibraryTarget(textimage) VERSION = 1.0.0 HEADERS += \ textimagehandler.h \ textimageplugin.h SOURCES += \ textimagehandler.cpp \ textimageplugin.cpp target.path += $$[QT_INSTALL_PLUGINS]/imageformats INSTALLS += target DISTFILES += \ textimageplugin.json
What does
TARGET = $$qtLibraryTarget(textimage)
do? why is it needed?Your plugin is named: textimage1.dll It is missing the d suffix for your debug build.
On Windows, the library must be called
textimage1d.dll
if it is a debug version. The reason was already explained above: On Windows, you cannot mix debug and release objects. -
Ok but were do i change the name with the d suffix? In the pro file? Or can i just rename it manually?
-
@sandro4912 said in QImageIOPlugin doesn't work:
Ok but were do i change the name with the d suffix? In the pro file? Or can i just rename it manually?
Simply read @SGaist 's answer: 'You can use TARGET = $$qtLibraryTarget(textimage)'
-
I added the target but it doesn't seem to add the d suffix to make it debug:
TEMPLATE = lib CONFIG += plugin VERSION = 1.0.0 HEADERS += \ textimagehandler.h \ textimageplugin.h SOURCES += \ textimagehandler.cpp \ textimageplugin.cpp TARGET = $$qtLibraryTarget(textimage) target.path += $$[QT_INSTALL_PLUGINS]/imageformats INSTALLS += target DISTFILES += \ textimageplugin.json
-
Did you re-run qmake after changing the TARGET value ?
-
Ok i guess i forgot to rerun it. Now i could generate the debug files.
When running my testprogram with debug it stills fails but the message is different
Got keys from plugin meta data () QFactoryLoader::QFactoryLoader() checking directory path "E:/Cpp_Projekte/QT/Foundations_of_QT/CH11_image_plugin/read/build-read-Desktop_Qt_5_12_2_MSVC2017_32bit-Debug/debug/imageformats" ... loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qgifd.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qicnsd.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qicod.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qjpegd.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qsvgd.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qtgad.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qtiffd.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qwbmpd.dll" loaded library "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qwebpd.dll" "bmp" "cur" "gif" "icns" "ico" "jpeg" "jpg" "pbm" "pgm" "png" "ppm" "svg" "svgz" "tga" "tif" "tiff" "wbmp" "webp" "xbm" "xpm" Failed to load. QLibraryPrivate::unload succeeded on "E:/Qt/5.12.2/msvc2017/plugins/styles/qwindowsvistastyled.dll" QLibraryPrivate::unload succeeded on "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qgifd.dll" QLibraryPrivate::unload succeeded on "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qicnsd.dll" QLibraryPrivate::unload succeeded on "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qicod.dll" QLibraryPrivate::unload succeeded on "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qjpegd.dll" QLibraryPrivate::unload succeeded on "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qsvgd.dll" QLibraryPrivate::unload succeeded on "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qtgad.dll" QLibraryPrivate::unload succeeded on "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qtiffd.dll" QLibraryPrivate::unload succeeded on "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qwbmpd.dll" QLibraryPrivate::unload succeeded on "E:/Qt/5.12.2/msvc2017/plugins/imageformats/qwebpd.dll" QLibraryPrivate::unload succeeded on "E:/Qt/5.12.2/msvc2017/plugins/platforms/qwindowsd.dll"
let me know if you need more information...