user63898
user63898

Reputation: 30943

Qt : how to debug and get the source of signal and slots linking error’s

Hi sometimes when i change large code base written in Qt , after compilnig it im getting linking errors that talking about something wrong in “metaObject” but i have no idea what is the source of the problem , how can i get more info from this error :

1>Linking...
1>TestDialog.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall TestDialog::metaObject(void)const " (?metaObject@TestDialog@@UBEPBUQMetaObject@@XZ)
1>TestDialog.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall TestDialog::qt_metacast(char const *)" (?qt_metacast@TestDialog@@UAEPAXPBD@Z)
1>TestDialog.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall TestDialog::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@TestDialog@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
1>TestDialog.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const TestDialog::staticMetaObject" (?staticMetaObject@TestDialog@@2UQMetaObject@@B)
1>debug\TestApp.exe : fatal error LNK1120: 4 unresolved externals

Upvotes: 1

Views: 391

Answers (1)

Frank Osterfeld
Frank Osterfeld

Reputation: 25165

Make sure the header the TestDialog is declared in (say testdialog.h) is added to the HEADERS section in your .pro file:

HEADERS += testdialog.h

Then re-run qmake.

Upvotes: 2

Related Questions