PDH
PDH

Reputation: 401

Multilevel inheritance in Qt

I am trying to implement multilevel inheritance for my Qt pages.

class MyPage1: public QWizardPage {

Q_OBJECT

...

}

and 

class MyPage2: public MyPage1 {
Q_OBJECT

...

}

The moc_MyPage2.cc is empty and while linking I am getting an error:

error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall dsw::MyPage2::metaObject(void)const " (?metaObject@MyPage2@dsw@@UBEPBUQMetaObject@@XZ)

Can someone please guide me?

Upvotes: 1

Views: 186

Answers (1)

László Papp
László Papp

Reputation: 53173

The moc_MyPage2.cc is empty and while linking I am getting an error,

error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall dsw::MyPage2::metaObject(void)const " (?metaObject@MyPage2@dsw@@UBEPBUQMetaObject@@XZ)

The linker error is expected if the moc file is not generated properly, so the real question is why the moc file was not generated properly.

A clean build should resolve this. Check then if the moc file is generated if you got the linker error again. Also, I assume you are using the Qt Add-In plugin for Visual Studio.

Upvotes: 1

Related Questions