Hi,
I am developping a serial port data frame decoder class which inherits from QThread. I have some custom slots and signals so I add the Q_OBJECT macro in my class declaration.
I add a moc step for my class and run the compiler ... I have the followings errors and don't know why neither what to fix.
SerialDataFrameDecoder.cpp
c:\qt\serialdataframedecoder\widgetsource\serialdataframedecoder.h(12) : error C2061: syntax error : identifier 'QVariant'
c:\qt\serialdataframedecoder\widgetsource\serialdataframedecoder.h(12) : error C2061: syntax error : identifier 'QVariant'
moc_SerialDataFrameDecoder.cpp
c:\qt\serialdataframedecoder\widgetsource\serialdataframedecoder.h(12) : error C2061: syntax error : identifier 'QVariant'
c:\qt\serialdataframedecoder\widgetsource\serialdataframedecoder.h(12) : error C2061: syntax error : identifier 'QVariant'
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(54) : error C2039: 'staticMetaObject' : is not a member of 'QThread'
c:\qt\3.3.3\include\qthread.h(56) : see declaration of 'QThread'
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(84) : error C2039: 'qt_cast' : is not a member of 'QThread'
c:\qt\3.3.3\include\qthread.h(56) : see declaration of 'QThread'
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(90) : error C2065: 'activate_signal' : undeclared identifier
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(105) : error C2039: 'qt_invoke' : is not a member of 'QThread'
c:\qt\3.3.3\include\qthread.h(56) : see declaration of 'QThread'
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(116) : error C2039: 'qt_emit' : is not a member of 'QThread'
c:\qt\3.3.3\include\qthread.h(56) : see declaration of 'QThread'
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(123) : error C2511: 'qt_property' : overloaded member function 'bool (int,int,class QVariant *)' not found in 'CSerialDataFrameDecoder'
c:\qt\serialdataframedecoder\widgetsource\serialdataframedecoder.h(10) : see declaration of 'CSerialDataFrameDecoder'
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(127) : error C2511: 'qt_static_property' : overloaded member function 'bool (class QObject *,int,int,class QVariant *)' not found in 'CSerialDataFra
meDecoder'
c:\qt\serialdataframedecoder\widgetsource\serialdataframedecoder.h(10) : see declaration of 'CSerialDataFrameDecoder'
Error executing cl.exe.
SerialDataFrameDecoder.cpp
c:\qt\serialdataframedecoder\widgetsource\serialdataframedecoder.h(12) : error C2061: syntax error : identifier 'QVariant'
c:\qt\serialdataframedecoder\widgetsource\serialdataframedecoder.h(12) : error C2061: syntax error : identifier 'QVariant'
moc_SerialDataFrameDecoder.cpp
c:\qt\serialdataframedecoder\widgetsource\serialdataframedecoder.h(12) : error C2061: syntax error : identifier 'QVariant'
c:\qt\serialdataframedecoder\widgetsource\serialdataframedecoder.h(12) : error C2061: syntax error : identifier 'QVariant'
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(54) : error C2039: 'staticMetaObject' : is not a member of 'QThread'
c:\qt\3.3.3\include\qthread.h(56) : see declaration of 'QThread'
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(84) : error C2039: 'qt_cast' : is not a member of 'QThread'
c:\qt\3.3.3\include\qthread.h(56) : see declaration of 'QThread'
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(90) : error C2065: 'activate_signal' : undeclared identifier
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(105) : error C2039: 'qt_invoke' : is not a member of 'QThread'
c:\qt\3.3.3\include\qthread.h(56) : see declaration of 'QThread'
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(116) : error C2039: 'qt_emit' : is not a member of 'QThread'
c:\qt\3.3.3\include\qthread.h(56) : see declaration of 'QThread'
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(123) : error C2511: 'qt_property' : overloaded member function 'bool (int,int,class QVariant *)' not found in 'CSerialDataFrameDecoder'
c:\qt\serialdataframedecoder\widgetsource\serialdataframedecoder.h(10) : see declaration of 'CSerialDataFrameDecoder'
c:\qt\serialdataframedecoder\widgetsource\moc_serialdataframedecoder.cpp(127) : error C2511: 'qt_static_property' : overloaded member function 'bool (class QObject *,int,int,class QVariant *)' not found in 'CSerialDataFra
meDecoder'
c:\qt\serialdataframedecoder\widgetsource\serialdataframedecoder.h(10) : see declaration of 'CSerialDataFrameDecoder'
Error executing cl.exe.
To copy to clipboard, switch view to plain text mode
My class declaration is the folowing
#ifndef _SERIAL_DATA_FRAME_DECODER_H
#define _SERIAL_DATA_FRAME_DECODER_H
#include <qthread.h>
class CSerialDataFrameDecoder
: public QThread{
Q_OBJECT
// Constructor / Destructor
public:
CSerialDataFrameDecoder();
// Slots
public slots:
void startDecode();
void stopDecode();
// Signals
signals:
void serialDataFrameDecoded();
// Functions
virtual void run();
};
#endif
#ifndef _SERIAL_DATA_FRAME_DECODER_H
#define _SERIAL_DATA_FRAME_DECODER_H
#include <qthread.h>
class CSerialDataFrameDecoder : public QThread
{
Q_OBJECT
// Constructor / Destructor
public:
CSerialDataFrameDecoder();
// Slots
public slots:
void startDecode();
void stopDecode();
// Signals
signals:
void serialDataFrameDecoded();
// Functions
virtual void run();
};
#endif
To copy to clipboard, switch view to plain text mode
and my class implementation is the following
#include "SerialDataFrameDecoder.h"
// Constructor / Destructor
CSerialDataFrameDecoder::CSerialDataFrameDecoder()
{
}
// Slots
void CSerialDataFrameDecoder::startDecode()
{
}
void CSerialDataFrameDecoder::stopDecode()
{
}
// Functions
void CSerialDataFrameDecoder::run()
{
}
#include "SerialDataFrameDecoder.h"
// Constructor / Destructor
CSerialDataFrameDecoder::CSerialDataFrameDecoder()
{
}
// Slots
void CSerialDataFrameDecoder::startDecode()
{
}
void CSerialDataFrameDecoder::stopDecode()
{
}
// Functions
void CSerialDataFrameDecoder::run()
{
}
To copy to clipboard, switch view to plain text mode
So what's wrong ?
Thanks in advance
Bookmarks