Qt - Q_OBJECT causes undefined reference to vtable
<p>I have the following class:</p>

<pre><code>class MySqlTableModel : public QSqlRelationalTableModel
{
    //Q_OBJECT

public:
    MySqlTableModel();

    QSqlQuery add;
    QSqlQuery login;
    QSqlQuery logout;

    void addUser(QString text);
    virtual Qt::ItemFlags flags(const QModelIndex &amp;index) const;
    bool adding = false;

public slots:
    void loginSlot();
    void logoutSlot();
};
</code></pre>

<p>Which derives from <code>QSqlRelationalTableModel</code>. I want to use some extra slots. My issue is, that if I comment the <code>Q_OBJECT</code> tag out, the slots are not recognized, and not connected(<code>QObject::connect: No such slot QSqlRelationalTableModel::MySqlTableModel::loginSlot()</code>). If I add the <code>Q_OBJECT</code> tag, however, I get an error: <code>/mysqltablemodel.cpp:5: error: undefined reference to vtable for MySqlTableModel'</code>, marking my constructor:</p>

<pre><code>MySqlTableModel::MySqlTableModel()
{
}
</code></pre>

<p>[EDIT]
Running qmake solved the compile error, but connect still doesn't seem to work. Am I doing something wrong here?
Thank you!</p>