在使用信号与槽很容易发生 undefined reference to 发射信号 

①继承QObject

②添加Q_OBJECT

③执行qmake

④构建

然后就可以运行啦!但是不知道是为什么,悄咪咪放在这里做个记录 。

 1 #ifndef TIMERWRITEFILE_H
 2 #define TIMERWRITEFILE_H
 3
 4 #include <QObject>
 5 #include <QDebug>
 6 #include <QTimerEvent>
 7 #include <QTextCodec>
 8 #include <OffSiteAlg.h>
 9
10 #define MAXPOTS     831
11
12 bool ReadWavesFile();
13
14 extern QString FileName;
15 extern bool PreviousFlag;
16 extern bool NextFlag;
17 extern bool IsChartDis;
18 extern bool StartOrStop;
19 extern int FreamCnt;//总帧数计数
20 extern int LocalCnt;
21
22 class TimerWriteFile : public QObject
23 {
24     Q_OBJECT
25 public:
26     explicit TimerWriteFile(QObject *parent = nullptr);
27     void  handleTimeout();  //超时处理函数
28     virtual void timerEvent( QTimerEvent *event);
29 private:
30     int m_nTimerID;
31     int TIMER_TIMEOUT;
32 signals:
33     void SIG_INSERTDATA(unsigned char *readbuf,int a, int b);
34     void SIG_TIMERPRAPAREDATA();
35 };
36
37 #endif // TIMERWRITEFILE_H
08-12 09:07