QT Error undefined reference to `vtable for MyThread'

MyThread是我自己新建的类,出现这种错误可以从四个方面排除。

  1. Make sure the Q_OBJECT macro is present in the definition of all QObject-derived classes.
  2. Make sure you declare your QObject-derived classes in your header files ONLY.
  3. Make sure all of your header files are listed in your .pro file in the HEADERS= list.
  4. Run qmake every time you add Q_OBJECT to one of your classes or modify your .pro file.

你可能感兴趣的:(Qt,c/c++)