c++ - Qt+VS2010 - Unresolvable external symbol LNK2001 -


all have main.cpp:

#include "myclass.h" #include <qapplication> #include <qtextedit> #include <qtgui>  class notepad : public qwidget {     q_object      public:          notepad();      private slots:         void quit();      private:         qtextedit *textedit;         qpushbutton *quitbutton;     };  notepad::notepad() {     textedit = new qtextedit();     quitbutton = new qpushbutton(tr("quit"));      connect(quitbutton, signal(clicked()), this, slot(quit()));      qvboxlayout *layout = new qvboxlayout;     layout->addwidget(textedit);     layout->addwidget(quitbutton);      setlayout(layout);      setwindowtitle(tr("notepad")); }  void notepad::quit() {     qmessagebox messagebox;     messagebox.setwindowtitle(tr("notepad"));     messagebox.settext(tr("do want quit?"));     messagebox.setstandardbuttons(qmessagebox::yes | qmessagebox::no);     messagebox.setdefaultbutton(qmessagebox::no);      if(messagebox.exec() == qmessagebox::yes)         qapp->quit(); }   int main(int argc, char *argv[]) {     qapplication app(argc, argv);      return app.exec(); } 

error info:

1>main.obj : error lnk2001: unresolvable external symbol "public: virtual struct qmetaobject const * __thiscall notepad::metaobject(void)const " (?metaobject@notepad@@ubepbuqmetaobject@@xz) 1>main.obj : error lnk2001: unresolvable external symbol "public: virtual void * __thiscall notepad::qt_metacast(char const *)" (?qt_metacast@notepad@@uaepaxpbd@z) 1>main.obj : error lnk2001: unresolvable external symbol "public: virtual int __thiscall notepad::qt_metacall(enum qmetaobject::call,int,void * *)" (?qt_metacall@notepad@@uaehw4call@qmetaobject@@hpapax@z) 1>main.obj : error lnk2001: unresolvable external symbol "public: static struct qmetaobject const notepad::staticmetaobject" (?staticmetaobject@notepad@@2uqmetaobject@@b) 

i'm new vs , qt, hope find solution this, thanks.

the problem have q_object in cpp file

class notepad : public qwidget {     q_object 

to make work need manually add moc step cpp compilation process. or move header file, it's done automatically


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -