title: Qt "No Such Slot QObject" Warning
body: <p>I am trying to connect a signal and slot using a QTimer as the sender of a signal.  Unfortunately, when I compile the code below, the program runs, but I receive a warning: "no such slot QObject::flip() in game.cpp".</p>
  
  <p>It seems that my slot is not properly defined.  Using a <a href="http://www.youtube.com/watch?v=pHc7siV2Ads" rel="nofollow">Youtube tutorial</a> about QTimer, it sounded as though I needed to add the "Q_OBJECT" macro inside the game class (this is commented out below).  However, if I uncomment it, the program fails to compile, providing the error message: "undefined reference to 'vtable for Game'".</p>
  
  <p>How do I properly connect my signal and slot for the timer?</p>
  
  <p><strong>game.h</strong></p>
  
  <pre><code>#ifndef GAME_H
  #define GAME_H
  
  #include "player.h"
  #include &lt;QtCore&gt;
  
  class Game : public QObject {
  
      //Q_OBJECT
  
  public:
      Game();
      void timed_job();
  
  public slots:
      void flip();
  
  private:
      bool is_game_on;
      QTimer *timer;
  
      Player player_1;
      Player player_2;
      Player player_3;
  };
  
  #endif // GAME_H
  </code></pre>
  
  <p><strong>game.cpp</strong></p>
  
  <pre><code>#include "game.h"
  #include &lt;QtCore&gt;
  
  Game::Game() {
      is_game_on = true;
  }
  
  void Game::timed_job() {
      timer = new QTimer(this);
      timer-&gt;start(1000);
      connect(timer, SIGNAL(timeout()), this, SLOT(flip()));
  }
  
  void Game::flip() {
      if(is_game_on == true) {
          is_game_on = false;
      }
      else {
          is_game_on = true;
      }
  }
  </code></pre>