Hi Alfkil, On Fri, Nov 20, 2009 at 08:22:12AM -0800, alfkil wrote: > > After compiling and linking libQtGui.a I try building an example which > returns this error: > > libQtGui.a(qprintdialog_unix.o):(.got2+0x94): undefined reference to `vtable > for QUnixPrintWidget' > > The class in question looks like this: > > class Q_GUI_EXPORT QUnixPrintWidget : public QWidget > { > Q_OBJECT > > public: > QUnixPrintWidget(QPrinter *printer, QWidget *parent = 0); > ~QUnixPrintWidget(); > void updatePrinter(); > > private: > friend class QPrintDialogPrivate; > friend class QUnixPrintWidgetPrivate; > QUnixPrintWidgetPrivate *d; > Q_PRIVATE_SLOT(d, void _q_printerChanged(int)) > Q_PRIVATE_SLOT(d, void _q_btnBrowseClicked()) > Q_PRIVATE_SLOT(d, void _q_btnPropertiesClicked()) > }; > > GCC version 4.2.4 (amigaos4). Tested the same code on mac os x 10.4 w/gcc > 4.0.1 and it runs fine. > > As you can see, it doesn't declare any methods virtual. So why would I get > the error here and not with the parent class? I also looked for "#pragma" > calls (inspired by a previous post) and didn't find any. I've read the gcc > faq section on vtable error, and read a lot of posts here and there, and I'm > still not sure, that I fully understand the issue at hand. Any > help/explanation/magic would be strongly appreciated!! Even if I don't know the solution to your problem: try the minimal (?) example: struct Base{ virtual void f(){} }; struct Derived : Base{ void f(); }; int main(){ Derived d; } This reproduces your error: I obtain " undefined reference to `vtable for Derived'" The reason is: As the Base-class has a virtual function (the Destructor in my example) and the derived class overloads ist, this is automatically also a virtual function - even if it is not explicitely declared virtual. The vtable for Derived is created as soon as I add the definition of Derived::f. After adding void Derived::f(){} to the code, it compiles fine. So I would subspect that you are missing the definitions of the functions of QUnixPrintWidget. Hth, Axel