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

后端 未结 23 2349
醉话见心
醉话见心 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:16

    I added cpp/ui files to my project manually, but forgot to add the header file explicitly as header file. Now when compiling I got a similar error message as above and the moc_*.cpp file(s) were not generated in the debug (or release) directory of the build. That was not such an obvious mistake, qmake did not complain and other than the linker message I got no errors.

    So if anyone encounters the same problem again (or makes the same copy & pase mistake): make sure the header files have also been added to your project file

提交回复
热议问题