This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Own Qt4 lib: undefined reference to `vtable for ..`

Tags: qt4, development, compiler qt4, development, compiler qt4, development, compiler
(comma "," separated)
Ximion
Registered Member
Posts
3
Karma
0
OS
Hi!
I'm trying to fix this error in my project for more than three days and tried all hints I found on the internet, read the GCC documentation: Nothing helped.

The situation is the following: I write a library libfoo-qt which provides Qt4 classes for libfoo to provide Qt4 bindings. Libfoo-qt is linked against libfoo.
Then I have another Qt4 lib, (a plugin) which is linked against libfoo-qt => Linking works, but I get an "undefined reference" error if I want to use the plugin.
I also link a KDE application against the libfoo-qt library. Linking fails with this reference error:
Code: Select all
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/libfoo-qt.so: undefined reference to `vtable for NameSpace::QClass'
(...)

Does someone know why I experience this error? If don't have any virtual funktion inside of the classes and I haven't set visibility=hidden too.
pinotree
KDE Developer
Posts
222
Karma
7
OS
Is that "NameSpace::QClass" inheriting directly or indirectly from QObject? If so, did you handle the moc files generation in the build system (which one are you using?) of your library?


Pino Toscano
Ximion
Registered Member
Posts
3
Karma
0
OS
The classes inherit directly from QObject:
Code: Select all
class Setup : public QObject
{
  Q_OBJECT 
public:

The build-system (cmake) does this:
qt4_automoc(${foo_SRCS})

I do not include any moc-file explicit in source code at time...
Hmm... How can I check if the moc files are really built? I do not get any make/cmake messages about building moc files.
Ximion
Registered Member
Posts
3
Karma
0
OS
I resolved it!
After using qt4_wrap_cpp instead of qt4_automoc the error is gone!
Thanks for the hint!


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]