QObject derivatives in CodeLite: Q_OBJECT macro failing:

General questions regarding the usage of CodeLite
mikey
CodeLite Enthusiast
Posts: 24
Joined: Thu Apr 18, 2013 9:46 am
Genuine User: Yes
IDE Question: C++
Contact:

QObject derivatives in CodeLite: Q_OBJECT macro failing:

Post by mikey »

Using CodeLite 5.1.2 on Ubuntu RR/Gnome with Qt 4.8.1, default C++ Gtk toolchain.

CodeLite 5.1.2 works very well with Qt. My include paths are:

Code: Select all

    /usr/include/qt4
    /usr/include/qt4/QtCore
    /usr/include/qt4/QtGui

But when writing QObject derived classes, adding the Q_OBJECT macro to the class declaration causes a compiler error:

Code: Select all

'...undefined reference to `vtable for MyQObjectClass'
How do I fix this using the CodeLite IDE?
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: QObject derivatives in CodeLite: Q_OBJECT macro failing:

Post by eranif »

IIRC, When adding Q_OBJECT, you should run qmake again - this will generate the moc_* files
You should then add those moc_* files to the workspace and compile

Eran
Make sure you have read the HOW TO POST thread
mikey
CodeLite Enthusiast
Posts: 24
Joined: Thu Apr 18, 2013 9:46 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: QObject derivatives in CodeLite: Q_OBJECT macro failing:

Post by mikey »

OK - anyhow, thanks for the help.

As it is, I've been trying to decide whethere to use GTK+/gtkmm or Qt, and I think I've decided to go with the GTK options. Qt binds you too much to their own framework IMO. Thanks to your help on StackOverflow.com I've got gtkmm up and running very nicely and I found some good docs about it. Using Glade, not to build my GUI's but just to learn the names of the widgets, properties etc and see how they interact. Then I code it myself. Found that using Glade with Gtk::Builder is too opaque and restrictive. I like to see the source code. I know you have wxbuilder in there with codelite and it generates code, but wxWidgets didn't feel very intuitive to me.


BTW, I'm an advocate and supporter of codelite - try to give a few bucks every month. I had been searching for an IDE that I felt comfortable with for a long time and codelite is perfect for me.

Thanks,
L'hitraot
Post Reply