title: qt app failed to build
body: <p>I'm developing an app in Qt/C++, the goal of this app is just to scan periodically usb ports and in case the app found a specific usb device, it's start an application.</p>
  
  <p>I have used QTimer but it seems not working. different search show that Q_OBJECT is required to make it work but as soon as I add Q_OBJECT the build failed.</p>
  
  <p>Here is the error</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "vtable for UsbDetection", referenced from:
        UsbDetection::UsbDetection() in usbdetection.o
        UsbDetection::~UsbDetection() in usbdetection.o
    NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  </code></pre>
  
  <p>here is the header</p>
  
  <pre><code>class UsbDetection : public QObject
  {
      Q_OBJECT
  public:
      UsbDetection();
      ~UsbDetection();
      bool isConnected();
      QTimer *activeTimer;
      void StartAgent();
  
  public slots:
      void ScanUSB();
  };
  </code></pre>
  
  <p>here the c code of the class</p>
  
  <pre><code>UsbDetection::UsbDetection()
  {
  }
  
  UsbDetection::~UsbDetection()
  {
      activeTimer-&gt;deleteLater();
  }
  
  void UsbDetection::StartAgent() {
      activeTimer = new QTimer(0);
      activeTimer-&gt;setSingleShot(false);
      activeTimer-&gt;setInterval(1000);
      connect(activeTimer, SIGNAL(timeout()), this, SLOT(UsbDetection::ScanUSB()));
      activeTimer-&gt;start();
  
  }
  
  bool UsbDetection::isConnected() {
      libusb_context *context = NULL;
      libusb_device **list = NULL;
      bool DeviceConnected = false;
      int rc = 0;
      ssize_t count = 0;
  
      rc = libusb_init(&amp;context);
  
      count = libusb_get_device_list(context, &amp;list);
      if(count == 0) {
          return DeviceConnected;
      }
      for (size_t idx = 0; idx &lt; count; ++idx) {
              libusb_device *device = list[idx];
              libusb_device_descriptor desc = {0};
              rc = libusb_get_device_descriptor(device, &amp;desc);
              if(rc != 0) {
                  return DeviceConnected;
              }
              if(desc.idVendor == PRODUCT_ID) {
                  DeviceConnected = true;
                  return DeviceConnected;
              }
       }
      return DeviceConnected;
  }
  
  void UsbDetection::ScanUSB() {
      if(isConnected() == true) {
          QString agentExecutableDirPath = QApplication::applicationDirPath();
          QString fileBrowserExecutablePath = agentExecutableDirPath + "/../../../../MacOS/connect";
          QProcess *process = new QProcess();
          process-&gt;startDetached(fileBrowserExecutablePath);
      }
  }
  </code></pre>
  
  <p>I don't see why the build failed.</p>