Bug#36018: undefined reference to '... virtual table'
aweiss at informatik.hu-berlin.de
Mon Jan 7 11:04:02 UTC 2002
I have decided to send the bugreport, since the problem occured frequently in
my (first) KDE-project. I was playing with signals/slots in order to
understand the mechanism and use it in a signal-processing application.
In _all_ cases the linker-error occured, the Q_OBJECT-macro was used in the
class that threw up the error, and it inherited QObject directly or
indirectly (inherited a QObject-derived class). So the moc was always
required to be called, if I understand well.
Make clean or make distclean and rebuilding the project didn't come over the
problem in any case. Only renaming of the relevant filenames (not
nessessarily the classname) had the effect to make the error disappear. (In
the beginning, I first tried to make several changes in my sources, without
success - later I started with renaming the affected filenames, successfully
in most cases).
Some years ago I had a different problem that came from dynamic linking and
that was depending on filenames. In some cases, ld was not able to resolve
constructors of static members, when linkage was done dynamically. Switching
to static linkage with a well-defined link-order solved the problem in that
case. Maybe in this problem ld gets confused by the order of linking objects
together (is this depending on filenames?), especially when resolving
constructors. Right now, I'm not familiar with linker-options in kdevel - I
even don't understand why my project is linked with both libraries, qt and
qt-mt, althought I have disabled linking with qt. But this is a different
question. Maybe, switching to static linkage would come around the undefined
references, but in most cases we should prefer dynamic linking ;)
I can send you some of my sources, if you want to see the described effect,
let me know if you want them.
Greetings from Berlin,
Am Sonntag, 6. Januar 2002 23:30 schrieb Michael Uplawski:
> Although I am not sure, that I have completely understood the
> bugreport # 36018, I suggest to clean/rebuild the whole project.
> Are in the example, mentioned, any QObject- or KDE-classes involved
> that require the (Qt-) moc to be called? ;-)
> Sorry, if I am wrong. But the message about the virtual table is
> always reminding me, that I have recently decided to implement
> Signals and/or Slots in classes, which are originally not inheriting
> from QObject-, or that I have once more forgotten to note the
Humboldt-Universität zu Berlin
Institut für Informatik
Signalverarbeitung und Mustererkennung
Dipl. Inf. Axel Weiß
Post: Unter den Linden 6
Sitz: Rudower Chaussee 25
More information about the KDevelop-devel