plugin uses incompatible Qt library
-
I am trying to build my first custom widget in Qt Creator 8.0.2 based on Qt 6.3.2 on Windows 10.
I got it to build and install.
I used the MS Visual C compiler and did a Release build because I read somewhere that it was needed for plugin dll's.
In the .pro file I had to comment out the $target.path and change it to C:/Qt/Tools/QtCreator/bin/plugins/designer so "make install" would install in the correct directory for Qt Creator.
When I go to Tools -> Form Editor -> About Qt Designer Plugins, I get the following error:The plugin 'C:/Qt/Tools/QtCreator/bin/plugins/designer/PMWidgetPlugin.dll' uses incompatible Qt library. (6.4.0) [release]
Does anyone know what I'm doing wrong?
-
I am trying to build my first custom widget in Qt Creator 8.0.2 based on Qt 6.3.2 on Windows 10.
I got it to build and install.
I used the MS Visual C compiler and did a Release build because I read somewhere that it was needed for plugin dll's.
In the .pro file I had to comment out the $target.path and change it to C:/Qt/Tools/QtCreator/bin/plugins/designer so "make install" would install in the correct directory for Qt Creator.
When I go to Tools -> Form Editor -> About Qt Designer Plugins, I get the following error:The plugin 'C:/Qt/Tools/QtCreator/bin/plugins/designer/PMWidgetPlugin.dll' uses incompatible Qt library. (6.4.0) [release]
Does anyone know what I'm doing wrong?
@JimK said in plugin uses incompatible Qt library:
Does anyone know what I'm doing wrong?
You need to compile your plugin against the Qt version QtCreator 8.0.2 is built with.
-
<< Sorry in advance for the strange formatting but I didn't try to format this message at all.>>
OK.
I downloaded Qt 6.3.2 and re-made it and the Widget now loads correctly in Qt Creator.
THANK YOU!But when I try to use it, I can't link.
It looks good in Designer.
(I'm still using the MSVS compiler.)
I copied the .lib file into the Source directory and right clicked on the .pro file to add the library.==================================================================
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/./ -lPMWidgetPlugin
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/./ -lPMWidgetPlugindINCLUDEPATH += $$PWD/.
DEPENDPATH += $$PWD/.But I still get the message:
===============================================================================================
mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl PMWidget::PMWidget(class QWidget *)" (??0PMWidget@@QEAA@PEAVQWidget@@@Z) referenced in function "public: void __cdecl Ui_MainWindow::setupUi(class QMainWindow *)" (?setupUi@Ui_MainWindow@@QEAAXPEAVQMainWindow@@@Z)The .lib file is very small. I don't see how it could have the object code in it. Does it somehow tell the linker to find the .dll at runtime?
Why can't I link? -
The plugin for Designer (embedded in Qt Creator) must be built with the version of the Qt libraries that Qt Creator was built with. In your case this is Qt 6.3.2. This plugin provides the ability to visualise your widget in Designer.
When you build a project that uses your widget then you need a version of your widget, not the Qt Creator plugin, built with the target Qt version for your project. Note that this will generally not be the same version as the one Qt Creator was built with. In your case it is probably Qt 6.4.0
BTW, having the ability to visualise the widget in Designer (Qt Creator) is convenient but not essential. You can just insert a placeholder QWidget and use the Promote function to generate the correct code.
-
When you are building an application that uses your widget then the library file (*.lib) containing the PMWidget, not the Designer plugin, needs to be in a location that can be found on the linker search path, either a default location or somewhere specified in the
-L
option(s) in LIBS. -
When you are building an application that uses your widget then the library file (*.lib) containing the PMWidget, not the Designer plugin, needs to be in a location that can be found on the linker search path, either a default location or somewhere specified in the
-L
option(s) in LIBS.I think I finally understand.
The .lib or .a files that are output from the Designer Plugin build are completely worthless.
I need to rebuild a project that turns the widget itself into a library and link with that.
This means that there is a very big chance that the Designer plugin and the Widget Library will not be in sync.At any rate, I made a new project that makes a library with just the widget itself and I can link and run.
Thank you.