Can't use custom widget, error: undefined reference to `Custom widget
I build a custom widget for QT Designer. This custom widget now shows up in the QTDesigner Widgetbox and I could drag and drop it into my ui.
Here is the problem:
when I start compiling my code, there is an error undefined reference to `Custom widget. I include the .h-File of the Plugin and it seams that the linkt to the sources of my plugin are missing. so I included the .dll File of the Pluging in the .pro File LIBS += "D:/Test/customwidget.dll". but I still get the same error. Whats wrong and how can I fix this error.
Tanks for your help :)
You don't link against a DLL on windows but a lib file, that was generated when you compiled the plugin.
You should have something like
@LIBS += -lcustomwidget@
okay the name of my custom widget is MyLabel, but when I add
@LIBS += -lmylabelget@
there is an error:
cannot find -mylabelget. when I write:
@LIBS += -LMyLabelget@
there is no cannot find ...
but then again there is the other error undefinde reference to
At first, Do you have the MyLabelget.dll and MyLabelget.lib exist or not before your create the designer plugin?
If not, you should add xxxx.h and xxxx.cpp to your .pro file directly.
By the way, please not that, the designer plugin has nothing to do with your application, it only make sense when you design your ui.
Normally, if you want to create a library for custom widgets, you should create the library first. then create a designer plugin which depending on the first library. The plugin is optional.
when I build my custom widget I get a .dll and a .lib file. where do i have to copy these two files, to make the plugin work correctly?
Just to be sure: Do you have a library containing your widget and another containing your Designer plugin ?