[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Problems with shared libraries
From:       Alf Lewerken <lewerken () mail ! bicos ! de>
Date:       1999-08-27 5:59:21
[Download RAW message or body]

Am Thu, 26 Aug 1999 schrieb massimo.bertani@it.abb.com:
> Hello
> 
> I'm developing a nice "analog instrument" widget under KDE1.1.0.
> 
> Until today the whole instrument class code (3 classes working together) was
> statically linked with some test code in one unique executable "demo".
> 
> All the environment (configure, tools etc.) was built using KAppTemplate (plus
> some little hacking) and everything ran OK.
> 
> Now I need to split the "demo" to two distinct parts: a shared library
> containing the widgets and the executable "demo", so I took as example the
> document "Example Makefile.am for a Shared Library" by David Sweet, then I built
> two separate directories for the library and the demo.
> 
> The library compiles with no problems, both static and shared libraries are
> generated and regularly installed with the relative header files.
> 
> But when I try to link the demo against the shared library, ld complains:
> 
> /opt/kde/lib/libqm.so: undefined reference to `QAnalogMeter::QPaintDevice
> virtual table'
> /opt/kde/lib/libqm.so: undefined reference to `QAnalogIndex virtual table'
> /opt/kde/lib/libqm.so: undefined reference to `QAnalogScale::QPaintDevice
> virtual table'
> /opt/kde/lib/libqm.so: undefined reference to `QAnalogMeter virtual table'
> /opt/kde/lib/libqm.so: undefined reference to `QAnalogIndex::QPaintDevice
> virtual table'
> /opt/kde/lib/libqm.so: undefined reference to `QAnalogScale virtual table'
> collect2: ld returned 1 exit status
> 
> some ideas?
> 
> Best regards,
> 
> /v\ax

Hi!

I had the same problem!
I hava forgotten the Q_OBJECT in the class-definition like:
class foo : public bar {
  Q_OBJECT
  ....
}

This Q_OBJECT-Macro causes the automoc perl script to process the header
for moc generates the .moc.cpp.

This .moc.cpp should linked to you library too.

bye


Alf Lewerken

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic