title: undefined reference to `vtable for myClass'
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1552069/undefined-reference-to-vtable-trying-to-compile-a-qt-project">Undefined reference to vtable. Trying to compile a Qt project</a>  </p>
  </blockquote>
  
  
  
  <p>here is the code </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;QApplication&gt;
  #include &lt;QTimer&gt;
  
  
  class myClass : public QObject {
      Q_OBJECT
  
  public:
      QTimer *timer;
      myClass(){
          timer = new QTimer(this);
          connect(timer, SIGNAL(timeout()), this, SLOT(mySlot()));
          timer-&gt;start(1000);
      }
  public slots:
      void mySlot() {
          std::cout &lt;&lt; "Fire" &lt;&lt; std::endl;
      }
  };
  
  int main() {
      std::cout &lt;&lt; "Hello, world";
      myClass atimer;
      return 0;
  }
  </code></pre>
  
  <p>Apart from the error, there are two more things I don't understand:</p>
  
  <ol>
  <li><p>Why there isn't any semicolon after macros, in this case Q_OBJECT. It doesn't seem to obey C++ syntax but yet people write code like that.</p></li>
  <li><p>The "public slots" is a modifier created by Qt, but how come gcc compiler can still understand it. How could an IDE like Qt modify the standard syntax of a language?</p></li>
  </ol>