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

后端 未结 23 2357
醉话见心
醉话见心 2020-11-30 21:33

I inherited a class from QObject :

class Parent: public QObject
{
    Q_OBJECT
    QObject* cl;

public:
    Parent(QObject *parent=0):QObject(parent) {
            


        
23条回答
  •  半阙折子戏
    2020-11-30 22:22

    I had this problem with Visual Studio 2012 when I had a Q_OBJECT class definition in my cpp file. Moving the class definition to the header file resolved the issue.

    It looks like it should be possible to support Q_OBJECT class in cpp file by adding the cpp file to moc but I did not try this.

提交回复
热议问题