I have been creating Qt applications for some time and am familiar with the steps necessary in order to integrate Qt into a project, however, I am currently experiencing some problems I have not seen before.
When I attempt to add the Q_OBJECT keyword into my class, I get linker errors as follows:
error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall ClientGUI::metaObject(void)const " (?metaObject@ClientGUI@MPT@ar@@UBEPBUQMetaObject@@XZ)
1>ClientGUI.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall ClientGUI::qt_metacast(char const *)" (?qt_metacast@ClientGUI@MPT@ar@@UAEPAXPBD@Z)
1>ClientGUI.
obj : error LNK2001
: unresolved external symbol
"public: virtual int __thiscall ClientGUI::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@ClientGUI@MPT@ar@@UAEHW4Call@
QMetaObject@@HPAPAX@Z
)
error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall ClientGUI::metaObject(void)const " (?metaObject@ClientGUI@MPT@ar@@UBEPBUQMetaObject@@XZ)
1>ClientGUI.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall ClientGUI::qt_metacast(char const *)" (?qt_metacast@ClientGUI@MPT@ar@@UAEPAXPBD@Z)
1>ClientGUI.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall ClientGUI::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@ClientGUI@MPT@ar@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
To copy to clipboard, switch view to plain text mode
When I take out the Q_OBJECT tag I then get unresolved external linker errors for my signals. When I have seen this in the past it was usually because I forgot to add the header files to be MOCed, but I have made sure that this is in fact happening in my project. I have also made sure my class is deriving from QObject.
I am using CMake 2.8 and the CMake file is virtually identical to another project I have done with Qt that is working fine.
Any help is appreciated,
Dustin
Bookmarks