title: undefined reference to `vtable for DigitalClock' - undefined reference to `DigitalClock::staticMetaObject' - Qt
body: <pre><code>anisha@linux-dopx:~/Desktop/notes/pomodoro&gt; ls
  timer.cpp
  
  anisha@linux-dopx:~/Desktop/notes/pomodoro&gt; qmake -project
  anisha@linux-dopx:~/Desktop/notes/pomodoro&gt; qmake
  anisha@linux-dopx:~/Desktop/notes/pomodoro&gt; make
  g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../qtsdk-2010.05/qt/mkspecs/linux-g++-64 -I. -I../../../qtsdk-2010.05/qt/include/QtCore -I../../../qtsdk-2010.05/qt/include/QtGui -I../../../qtsdk-2010.05/qt/include -I. -I. -o timer.o timer.cpp
  g++ -m64 -Wl,-O1 -Wl,-rpath,/home/anisha/qtsdk-2010.05/qt/lib -o pomodoro timer.o    -L/home/anisha/qtsdk-2010.05/qt/lib -lQtGui -L/home/anisha/qtsdk-2010.05/qt/lib -L/usr/X11R6/lib64 -lQtCore -lpthread 
  timer.o: In function `DigitalClock::DigitalClock(QWidget*)':
  timer.cpp:(.text+0x151): undefined reference to `vtable for DigitalClock'
  timer.cpp:(.text+0x159): undefined reference to `vtable for DigitalClock'
  timer.cpp:(.text+0x1bc): undefined reference to `DigitalClock::staticMetaObject'
  timer.o: In function `main':
  timer.cpp:(.text+0x2c0): undefined reference to `vtable for DigitalClock'
  timer.cpp:(.text+0x2c9): undefined reference to `vtable for DigitalClock'
  timer.cpp:(.text+0x30f): undefined reference to `vtable for DigitalClock'
  timer.cpp:(.text+0x318): undefined reference to `vtable for DigitalClock'
  collect2: ld returned 1 exit status
  make: *** [pomodoro] Error 1
  </code></pre>
  
  <p>My pomodoro.pro:</p>
  
  <pre><code>######################################################################
  # Automatically generated by qmake (2.01a) Tue Feb 14 10:32:09 2012
  ######################################################################
  
  TEMPLATE = app
  TARGET = timer
  DEPENDPATH += .
  INCLUDEPATH += .
  
  # Input
  SOURCES += timer.cpp
  </code></pre>
  
  <p>My timer.cpp:</p>
  
  <pre><code>#include &lt;QLCDNumber&gt;
  #include &lt;QtGui&gt;
  #include &lt;QApplication&gt;
  
  class DigitalClock : public QLCDNumber
  {
      Q_OBJECT
      public:
          DigitalClock (QWidget *parent = 0);
      private slots:
          void showTime();
  };
  
  DigitalClock :: DigitalClock (QWidget *parent) : QLCDNumber (parent)
  {
      setSegmentStyle(Filled);
  
      QTimer *timer = new QTimer(this);
      connect (timer, SIGNAL(timeout()), this, SLOT(showTime()));
      timer-&gt;start (1000);
  
      showTime();
  
      setWindowTitle (tr ("Digital Clock"));
      resize (150, 60);
  }
  
  void DigitalClock :: showTime()
  {
      QTime time = QTime::currentTime();
      QString text = time.toString("hh:mm");
      if ((time.second() % 2) == 0)
          text[2] = ' ';
      display(text);
  }
  
  int main (int argc, char *argv[])
  {
      QApplication app(argc, argv);
  
      DigitalClock clock;
      clock.show();
  
      return app.exec();
  }
  </code></pre>