1
votes

I creati a simple class which extends two classes QObject and QThread.

When I compile it with MOC compiler there is an error:

expected class-name before ‘{’ token

Class started with this code:

class QSmartecVideoAudio : public QObject, public QThread
 {
 Q_OBJECT
 ...
 };

I implement run method but it doesnot work.

I include qthread.h at the beginning.

2

2 Answers

1
votes

Looks like an include issue. Try to add:

#include <QThread>
#include <QObject>

before your class definition.

1
votes

QThread inherits QObject already, so you must not inherit from QObject.

try:

class QSmartecVideoAudio : public QThread
{
   Q_OBJECT
   ...
};