• 4374阅读
  • 1回复

定义线程遇到的问题 [复制链接]

上一主题 下一主题
离线ediml
 

只看楼主 倒序阅读 楼主  发表于: 2006-05-31
— 本帖被 XChinux 从 Qt for Linux/X11 移动到本区(2010-02-08) —
我定义了一个class
class myThread : public Qthread{
  public:
  virtual void run();
};
void myThread::run(){
  int cnt=1;
  while(1){
  pcap_dispatch(p_handler,     //libpcap 句柄
      cnt,       //要抓取的数据包的个数
      ethernet_protocol_packet_callback, //回调函数
      NULL);     //传给回调函数的参数
 
  }
}
编译的时候:
.ui/mainform.h:52: 'myThread' is used as a type, but is not defined as a type.
In file included from mythread.h:2,   (我已经在mainform.ui.h头文件中加了#inculde "mythread.h")
............
mythread.h: At global scope:
mythread.h:5: parse error before `{' token
mythread.h:9: invalid use of undefined type `class myThread'
mythread.h:5: forward declaration of `class myThread'
是不是我定义class的格式有问题呢?
[ 此贴被ediml在2006-05-31 16:07重新编辑 ]
离线ediml

只看该作者 1楼 发表于: 2006-05-31
定义了以后我直接在Object Explorer的 Class Variables里加的 myThread pcap_thread
快速回复
限100 字节
 
上一个 下一个