title: Qt undefined reference to vtable
body: <p>I am a beginner to Qt programming and use codeblocks for my programming. I created 3 files communicate.h,commmunicate.cpp and main.cpp as follows:</p>
  
  <p><strong>communicate.h</strong></p>
  
  <pre><code>    #ifndef COMMUNICATE_H
      #define COMMUNICATE_H
  
      #include &lt;QWidget&gt;
      #include &lt;QApplication&gt;
      #include &lt;QPushButton&gt;
      #include &lt;QLabel&gt;
  
      class Communicate : public QWidget
      {
        Q_OBJECT
  
        public:
          Communicate(QWidget *parent = 0);
  
  
        private slots:
          void OnPlus();
          void OnMinus();
  
        private:
          QLabel *label;
  
      };
  
      #endif
  </code></pre>
  
  <p><strong>communicate.cpp</strong></p>
  
  <pre><code>#include "communicate.h"
  
  Communicate::Communicate(QWidget *parent)
      : QWidget(parent)
  {
    QPushButton *plus = new QPushButton("+", this);
    plus-&gt;setGeometry(50, 40, 75, 30);
  
    QPushButton *minus = new QPushButton("-", this);
    minus-&gt;setGeometry(50, 100, 75, 30);
  
    label = new QLabel("0", this);
    label-&gt;setGeometry(190, 80, 20, 30);
  
    connect(plus, SIGNAL(clicked()), this, SLOT(OnPlus()));
    connect(minus, SIGNAL(clicked()), this, SLOT(OnMinus()));
  }
  
  void Communicate::OnPlus()
  {
    int val = label-&gt;text().toInt();
    val++;
    label-&gt;setText(QString::number(val));
  }
  
  void Communicate::OnMinus()
  {
    int val = label-&gt;text().toInt();
    val--;
    label-&gt;setText(QString::number(val));
  }
  </code></pre>
  
  <p><strong>main.cpp</strong></p>
  
  <pre><code>#include "communicate.h"
  
  int main(int argc, char *argv[])
  {
    QApplication app(argc, argv);
  
    Communicate window;
  
    window.setWindowTitle("Communicate");
    window.show();
  
    return app.exec();
  }
  </code></pre>
  
  <p>and its showing errors as follows:</p>
  
  <pre><code>obj\Debug\main.o(.text$_ZN11CommunicateD1Ev[Communicate::~Communicate()]+0xb)||In function `ZN7QStringC1EPKc':|
  C:\Qt\4.4.3\include\QtCore\..\..\src\corelib\arch\qatomic_windows.h||undefined reference to `vtable for Communicate'|
  obj\Debug\main.o(.text$_ZN11CommunicateD1Ev[Communicate::~Communicate()]+0x17):C:\Qt\4.4.3\include\QtCore\..\..\src\corelib\arch\qatomic_windows.h||undefined reference to `vtable for Communicate'|
  obj\Debug\communicate.o(.text+0x172)||In function `ZN11CommunicateC2EP7QWidget':|
  E:\Project\cam2\communicate.cpp|5|undefined reference to `vtable for Communicate'|
  obj\Debug\communicate.o(.text+0x17e):E:\Project\cam2\communicate.cpp|5|undefined reference to `vtable for Communicate'|
  obj\Debug\communicate.o(.text+0x63a)||In function `ZN11CommunicateC1EP7QWidget':|
  E:\Project\cam2\communicate.cpp|5|undefined reference to `vtable for Communicate'|
  obj\Debug\communicate.o(.text+0x646):E:\Project\cam2\communicate.cpp|5|more undefined references to `vtable for Communicate' follow|
  ||=== Build finished: 6 errors, 0 warnings ===|
  </code></pre>
  
  <p>guys please help...cant figure it out...</p>