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

Robert Wood robert.wood at apostrophe.co.uk
Sat Feb 27 17:53:38 CET 2010


Stephen wrote:

> So the .so is called libqledplugin.so, correct?

Yes.

> Don't you also get an error indicating that the library cannot be found?

I didn't, no.

> I think you would need
>
> LIBS += -lqledplugin -L/opt/qtsdk-2010.02/qt/plugins/designer
>
> unless you also copy the .so to a directory that you know will be
> searched in the link.

Now, this does, indeed, allow the program to compile. However, in the 
application output tab in creator I got:

/home/robertw/Software/Qt4/Qt4Test/Qt4Test: error while loading shared 
libraries: libqledplugin.so: cannot open shared object file: No such 
file or directory

So, I copied the .so to /usr/lib as well and now it runs.

Now, bear in mind this is all new to me (I'm really a humble embedded 
micro programmer), is this a bit of a Heath Robinson way of doing it? 
Should I be really doing this with a make install that would 
automatically cope all the relevant files to the relevant places?

Andreas wrote:

 >> 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. <<

Yes, now you point it out, it does make sense. I had spent *so* long 
just trying to get designer to see the custom widget, I'd completely 
lost sight of the fact that my actual application needed to be able to 
"see" the shared library.

Thanks for your help, folks. :~)

Rob





More information about the Qt-interest-old mailing list