title: Qt: undefined reference on constructor of customer class
body: <p>I'm using a custom class, <code>GpibDevicesModel</code>, inheriting from <code>QAbstractTableModel</code>, and the compiler says that there is an undefined reference on the constructor. But I don't understand why.</p>
  
  <p>Here is the code: </p>
  
  <p>MainWindow.h </p>
  
  <pre><code>class MainWindow : public QMainWindow
  {
      Q_OBJECT    
  public: 
      MainWindow(QWidget *parent = 0);
      ~MainWindow();
      //...
  private:
      GpibDevicesModel *m_gpibDevicesModel;
  };
  </code></pre>
  
  <p>MainWindow.cpp</p>
  
  <pre><code>MainWindow::MainWindow(QWidget *parent)
      : QMainWindow(parent)
  {
      //...
      //undefined reference is located here 
      m_gpibDevicesModel = new GpibDevicesModel;
      //...
  }
  </code></pre>
  
  <p>GpibDevicesModel.h</p>
  
  <pre><code>#ifndef GPIBDEVICESMODEL_H
  #define GPIBDEVICESMODEL_H
  
  #include &lt;QAbstractTableModel&gt;
  class MeasureDevice;
  
  class GpibDevicesModel : public QAbstractTableModel
  {
      Q_OBJECT
  public:    
      enum Columns{
          NameCol = 0,
          AddressCol,
          IdCol,
          TypeCol,
          ConnectedCol,
          EndCol //Should always be at end
      };
  
      //constructor and destructor
      explicit GpibDevicesModel(QObject *parent = 0);
      ~GpibDevicesModel();
  protected:
      //Reimplemented from QAbstractTableModel
      QVariant data(const QModelIndex &amp;index, int role) const;
      int rowCount(const QModelIndex &amp;parent) const;
      int columnCount(const QModelIndex &amp;parent) const;
      QVariant headerData(int section, Qt::Orientation orientation, int role) const;
  
      //Data list getter and setter
      QList&lt;MeasureDevice *&gt; measureDevices() const;
      void setMeasureDevices(const QList&lt;MeasureDevice *&gt; &amp;measureDevices);
  
  private:
      QList&lt;MeasureDevice *&gt; m_measureDevices;
  };
  
  #endif // GPIBDEVICESMODEL_H
  </code></pre>
  
  <p>GpibDevicesModel.cpp</p>
  
  <pre><code>#include "gpibdevicesmodel.h"
  #include "measuredevice.h"
  
  #include &lt;QIcon&gt;
  
  
  GpibDevicesModel::GpibDevicesModel(QObject *parent)
      : QAbstractTableModel(parent)
  {}
  
  GpibDevicesModel::~GpibDevicesModel()
  {}
  
  QVariant GpibDevicesModel::data(const QModelIndex &amp;index, int role) const
  {
      if(!index.isValid() || index.row() &gt;= m_measureDevices.size())
          return QVariant();
  
      switch(role){
      //This is roles for ComboBox
      case Qt::DisplayRole:
          switch(index.column()){
          case NameCol: return m_measureDevices.at(index.row())-&gt;displayName();
          case AddressCol:return m_measureDevices.at(index.row())-&gt;gpibName();
          case IdCol: return m_measureDevices.at(index.row())-&gt;property("internal_id").toString();
          case TypeCol: return m_measureDevices.at(index.row())-&gt;typeString();
          }
          break;
      case Qt::DecorationRole:
          switch(index.column()){
          case ConnectedRole: {
              MeasureDevice *md = m_measureDevices.at(index.row());
              if(md-&gt;isConnected()) return QIcon(":/Icons/green_led.png");
              else return QIcon(":/Icons/red_led.png");
          }
          }
          break;
  
      }
      return QVariant();
  }
  
  int GpibDevicesModel::rowCount(const QModelIndex &amp;parent) const
  {
      Q_UNUSED(parent)
      return m_measureDevices.size();
  }
  
  int GpibDevicesModel::columnCount(const QModelIndex &amp;parent) const
  {
      Q_UNUSED(parent)
      return EndCol;
  }
  
  QVariant GpibDevicesModel::headerData(int section, Qt::Orientation orientation, int role) const
  {
      static QStringList headers = QStringList() &lt;&lt; tr("Name") &lt;&lt; tr("Address") &lt;&lt; tr("Id")
                                                 &lt;&lt; tr("Type") &lt;&lt; tr("Connected") ;
  
      if(role == Qt::DisplayRole &amp;&amp; orientation == Qt::Vertical)
          return QVariant(); //return section; //uncomment here to displayed row number
  
      if(section &gt;= headers.size())
          return QVariant();
  
      switch(role){
      case Qt::DisplayRole: return headers.at(section);
      }
      return QVariant();
  }
  
  QList&lt;MeasureDevice *&gt; GpibDevicesModel::measureDevices() const
  {
      return m_measureDevices;
  }
  
  void GpibDevicesModel::setMeasureDevices(const QList&lt;MeasureDevice *&gt; &amp;measureDevices)
  {
      beginResetModel();
      m_measureDevices = measureDevices;
      endResetModel();
  }
  </code></pre>
  
  <p>And here is the error message from the compiler</p>
  
  <pre><code>mainwindow.cpp:1430: undefined reference to  GpibDevicesModel::GpibDevicesModel(QObject*)'
  </code></pre>
  
  <p>I think that will be a stupid thing, as always... But I cannot figure out this error. I'm using another custom model in the same way and I don't have any problem.</p>