title: Qt+VS2010 - Unresolvable external symbol LNK2001
body: <p>All I have is a <code>main.cpp</code>:  </p>
  
  <pre><code>#include "myclass.h"
  #include &lt;QApplication&gt;
  #include &lt;QTextEdit&gt;
  #include &lt;QtGui&gt;
  
  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-&gt;addWidget(textEdit);
      layout-&gt;addWidget(quitButton);
  
      setLayout(layout);
  
      setWindowTitle(tr("Notepad"));
  }
  
  void Notepad::quit()
  {
      QMessageBox messageBox;
      messageBox.setWindowTitle(tr("Notepad"));
      messageBox.setText(tr("Do you really want to quit?"));
      messageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
      messageBox.setDefaultButton(QMessageBox::No);
  
      if(messageBox.exec() == QMessageBox::Yes)
          qApp-&gt;quit();
  }
  
  
  int main(int argc, char *argv[])
  {
      QApplication app(argc, argv);
  
      return app.exec();
  }
  </code></pre>
  
  <p>Error info:</p>
  
  <pre><code>1&gt;main.obj : error LNK2001: Unresolvable external symbol "public: virtual struct QMetaObject const * __thiscall Notepad::metaObject(void)const " (?metaObject@Notepad@@UBEPBUQMetaObject@@XZ)
  1&gt;main.obj : error LNK2001: Unresolvable external symbol "public: virtual void * __thiscall Notepad::qt_metacast(char const *)" (?qt_metacast@Notepad@@UAEPAXPBD@Z)
  1&gt;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&gt;main.obj : error LNK2001: Unresolvable external symbol "public: static struct QMetaObject const Notepad::staticMetaObject" (?staticMetaObject@Notepad@@2UQMetaObject@@B)
  </code></pre>
  
  <p>I'm new to VS and Qt, Hope to find a solution to this, thanks.</p>