sayyed mohsen zahraee sayyed mohsen zahraee - 3 months ago 50
C++ Question

Unresolved external symbol "public: virtual struct QMetaObject const * __thiscall Parent

I inherent a class from QObject :

class Parent: public QObject
{
Q_OBJECT
QObject* cl;

public:
Parent(QObject *paretn=0):QObject(paretn) {
cl = NULL;
}

QObject* getCl() const {
return cl;
}
void setCl(QObject *obj) {
cl = obj;
}
};


But when I write code bellow I get error:

Parent ev;


Error:

main.obj:-1: error: LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall Parent::metaObject(void)const " (?metaObject@Parent@@UBEPBUQMetaObject@@XZ)

main.obj:-1: error: LNK2001: unresolved external symbol "public: virtual void * __thiscall Parent::qt_metacast(char const *)" (?qt_metacast@Parent@@UAEPAXPBD@Z)

main.obj:-1: error: LNK2001: unresolved external symbol "public: virtual int __thiscall Parent::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@Parent@@UAEHW4Call@QMetaObject@@HPAPAX@Z)

Answer

You should delete the debug folder and run your program again to correct this problem.