PDA

View Full Version : moc link error



user_mail07
28th June 2007, 02:32
I am getting some linking errors with QMetaObject while trying to compile the application.


In the header .h files, the macro Q_OBJECT has been included. All moc-file are created in my generated files. I have been building with Vs 2003 and Qt 4.3.

But i still have no idea to get rid of following errors:-



mapDlg.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const mapDlg::staticMetaObject" (?staticMetaObject@mapDlg@@2UQMetaObject@@B)
mapDlg.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall mapDlg::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@mapDlg@@UAEHW4Call@QMetaObject@@HPAP AX@Z)
mapDlg.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall mapDlg::metaObject(void)const " (?metaObject@mapDlg@@UBEPBUQMetaObject@@XZ)
..\..\..\..\exe\mapDlg.dll : fatal error LNK1120:3 unresolved externals


Any idea will be helpful.

vermarajeev
28th June 2007, 05:17
Please provide more information eg .cpp and .h files

jacek
28th June 2007, 19:27
Are you sure that the library is linked against the code from the .moc file?

user_mail07
3rd July 2007, 19:30
Sorry for posting late.

The problem was fixed. After adding config += staticlib to the project file.

Thanks for ideas.