[Qt-creator] undefined reference to vtable for <Class Name> -happens in RC1

Gilles Valette gilles.valette at univ-reims.fr
Tue Feb 10 13:10:58 CET 2009


>
> As soon as a new class added to a project inherits from QObject and uses
> the Q_OBJECT macro the build fails.
>
> Example:
>
>    class ViewAdapter : public QObject
>
>    {
>
>        Q_OBJECT
>
>        Q_DISABLE_COPY(ViewAdapter)
>
>         .
>
>         .
>         .
>
>
> Error message is:
>
>
> undefined reference to 'vtable for ViewAdapter '
>
>
> Solving the problem:
>
> - "Clean Project" doesn't help
> - MUST unload and reopen the project. After this the build succeeds.
>

Hi,

I got the same issue and resolved it simply by running qmake. It seems that 
it is (was ?) not automatic when you add Q_OBJECT in a header.

Regards.

Gilles





More information about the Qt-creator-old mailing list