title: QT C++ error: undefined reference to `vtable for appprinter'
body: <p>question:
  i have a program that includes a printer class 'apppprinter',
  but when trying to compile i get the error: </p>
  
  <pre><code>appprinter.cpp:(.text+0x105): undefined reference to `vtable for appprinter'
  appprinter.cpp:(.text+0x10d): undefined reference to `vtable for appprinter'
  appprinter.o: In function `appprinter::printIt()':
  make: Leaving directory `/home/michael/projectOOI/HerkansingProjectOOI-build-desktop-Desktop_Qt_4_8_1_for_GCC__Qt_SDK__Release'
  appprinter.cpp:(.text+0x17f): undefined reference to `appprinter::staticMetaObject'
  appprinter.cpp:(.text+0x1e0): undefined reference to `appprinter::staticMetaObject'
  appprinter.cpp:(.text+0x23d): undefined reference to `appprinter::staticMetaObject'
  appprinter.cpp:(.text+0x3ab): undefined reference to `appprinter::staticMetaObject'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>header file:</p>
  
  <pre><code>#ifndef APPPRINTER_H
  #define APPPRINTER_H
  #include&lt;QObject&gt;
  #include&lt;QWidget&gt;
  #include &lt;QMap&gt;
  #include &lt;QComboBox&gt;
  #include &lt;QCalendarWidget&gt;
  #include &lt;QRadioButton&gt;
  #include &lt;QString&gt;
  #include &lt;QtGui&gt;
  #include "appointment.h"
  
  class appprinter : public QWidget
  {
      Q_OBJECT
  public:
      appprinter(QWidget * parent = 0, int i = 0, int option = 0);
      ~appprinter(){}
      void setList(QList&lt;appointment&gt; param) {goTo = param; printIt();}
      void printIt();
  public slots:
      void goNext() {showIter++; this-&gt;close();appprinter * help = new appprinter(this,showIter);help-&gt;setList(goTo); help-&gt;show();}
      void goPrev() {showIter--; this-&gt;close();appprinter * help = new appprinter(this,showIter);help-&gt;setList(goTo); help-&gt;show();}
  private:
      int showIter;
      QList&lt;appointment&gt; goTo;
      bool isUnder;
      int opt;
  };
  
  #endif // appprinter_H
  </code></pre>
  
  <p>cpp file: </p>
  
  <pre><code>#include "appprinter.h"
  
  appprinter::appprinter(QWidget * parent, int i, int option)
          : QWidget(parent)
  {
      showIter = i;
      if (option == 0);//needs further building
  
  }
  
  void appprinter::printIt()
  {
      QList&lt;appointment&gt; list = goTo;
      int i = showIter;
      QPushButton * showNext = new QPushButton(tr("Next"));
      connect(showNext,SIGNAL(clicked()),this,SLOT(goNext()));
      QPushButton * showPrev = new QPushButton(tr("Previous"));
      connect(showPrev,SIGNAL(clicked()),this,SLOT(goPrev()));
      QPushButton * closer = new QPushButton(tr("Close"));
      connect(closer,SIGNAL(clicked()),this,SLOT(close()));
  
      QGridLayout * lay = new QGridLayout;
      int counter = 0;
      QLabel * pTitle = new QLabel;
      QTextEdit * pDescription = new QTextEdit;
      QLabel * pDeadline = new QLabel;
      QLabel * pDeadlineTime = new QLabel;
      QLabel * pPriority = new QLabel;
      QLabel * pStatus = new QLabel;
      QLabel * emptyList = new QLabel(tr("No search results!"));
  
      if (list.count() != 0)
      {
          pTitle-&gt;setText(list[i].ShowTitle());
          pDescription-&gt;setText(list[i].ShowDescription());
          pDeadline-&gt;setText(list[i].ShowDate().toString());
          pDeadlineTime-&gt;setText(list[i].ShowStart().toString());
          if (i+1 &gt;= list.count())
              showNext-&gt;hide();
          else
              showNext-&gt;show();
          if (i &lt;= 0)
              showPrev-&gt;hide();
          else
              showPrev-&gt;show();
          lay-&gt;addWidget(pTitle,counter++,0);
          lay-&gt;addWidget(pDescription,counter++,0);
          lay-&gt;addWidget(pDeadline,counter++,0);
          lay-&gt;addWidget(pDeadlineTime,counter++,0);
          lay-&gt;addWidget(pPriority,counter++,0);
          lay-&gt;addWidget(pStatus,counter++,0);
          lay-&gt;addWidget(showPrev,counter,0,Qt::AlignLeft);
          lay-&gt;addWidget(showNext,counter,0,Qt::AlignRight);
          lay-&gt;addWidget(closer,++counter,0,Qt::AlignCenter);
          this-&gt;setFixedHeight(320);
      }
      else
      {
          lay-&gt;addWidget(emptyList,0,0);
          lay-&gt;addWidget(closer,1,0,Qt::AlignCenter);
          this-&gt;setFixedHeight(240);
      }
      setLayout(lay);
  
      if (list.count() != 0)
          setWindowTitle(list[i].ShowTitle());
  }
  </code></pre>
  
  <p>does anyone know a solution??</p>