[Qt-interest] Undefined reference to (any custom widget)

Andreas Pakulat apaku at gmx.de
Sat Feb 27 17:11:15 CET 2010


On 27.02.10 11:50:49, Robert Wood wrote:
> I'm trying to work out how to get a custom widget working with creator 
> that has been placed onto a form in designer.
> 
> I can compile carious custom widgets that I have from the example files 
> or downloaded from the web. I can compile them, copy the the .so file to 
> my /opt/qtsdk-2010.02/qt/plugins/designer/ directory and copy the header 
> file to /usr/lib/qt4/include/
> 
> They then appear in designer.
> 
> However, even with off-the-shelf widgets such as this:
> 
> http://qt-apps.org/content/show.php/QLed+?content=72482
> 
> I get:
> 
> /home/robertw/Software/Qt4/Qt4Test/ui_mainwindow.h:59: undefined 
> reference to `QLed::QLed(QWidget*)'
> 
> There are a few reference to this round the web, such as:
> 
> "Just add to your .pro file:
> LIBS += -lqledplugin"
> 
> None of which work.
> 
> Can anyone help please? If you need any more information just ask.

You're using the plugin in the wrong way. The designer plugins are only
there to make the widget available inside designer. To use the generated
.ui file you'll either have to include the source code for the widget in
your project or put the code into a shared library that both your
application and the plugin link to.

Linking to the plugin is not going to help you even when you add the
plugin-path via -L... as the plugin doesn't export any symbols for the
widget. It only has 1 public symbol and thats a C function that can
create an instance of the plugin class.

Andreas

-- 
The time is right to make new friends.



More information about the Qt-interest-old mailing list