title: Qt "signal undefined reference error" after inheriting from QObject
body: <p>I recently needed to add a signal to a class, so I changed the class to inherit from QObject and added the Q_OBJECT macro into the class definition.  Since doing so I get <strong>"signal undefined reference error for 'vtable for CLICommand'"</strong> error on the class line below:</p>
  
  <pre><code>// File clicommand.h
  #include &lt;QString&gt;
  #include &lt;QStringList&gt;
  #include &lt;QTcpSocket&gt;
  #include "telnetthread.h"
  class CLICommand : public QObject
  {
  Q_OBJECT
  public:
      CLICommand(TelnetThread *parentTelnetThread);
  signals:
      void signal_shutdown_request(); 
  private:
      TelnetThread *m_parentTelnetThread;
  </code></pre>
  
  <p>and the second error <strong>"signal undefined reference error for 'vtable for CLICommand'"</strong> on the line below (intializing the member variable):</p>
  
  <pre><code>// File clicommand.cpp
  #include &lt;QDebug&gt;
  #include &lt;QTcpSocket&gt;
  #include &lt;QTextStream&gt;
  #include "version.h"
  #include "clicommand.h"
  #include "telnetthread.h"
  #include "logger.h"
  CLICommand::CLICommand(TelnetThread *parentTelnetThread)
    : m_parentTelnetThread(parentTelnetThread)
  {
  }
  </code></pre>
  
  <p>and just here is where I emit the signal.  The emit line generates error <strong>undefined reference to `CLICommand::signal_shutdown_request()'</strong> :</p>
  
  <pre><code>// file shutdown_clicommand.cpp
  #include &lt;QIODevice&gt;
  #include "clicommand.h"
  #include "logger.h"
  #include "version.h"
  void CLICommand::execute_shutdown(const QStringList &amp;commandLineFragments)
  {
      emit signal_shutdown_request();
  }
  </code></pre>
  
  <p>I've read a bunch of posts on this topic but none seem to apply.  I even tried clean/rebuildall.  I am not using boost or other libraries...just QT 5</p>
  
  <p>Can someone tell me what I'm doing wrong?  </p>
  
  <hr>
  
  <p>SOLUTION: in QT Creator, right click the project, select RUN QMAKE, then rebuild all.   Other posts about running REBUILD ALL are incorrect...on it's own that will NOT run qmake.</p>