用QT作一个接收GPS信号的程序,在GPSForm里开了两个线程,一个负责读串口的GPS接收的数据,另一个负责在界面中显示.用的是linux下的pthread库
在gpsform.cpp 中,
.....
void GPSForm::start() //由按钮触发这个事件
{
pthread_create(&rece_thread, NULL, receive, 0);
pthread_create(&show_thread, NULL, show_gps_info, 0);
}
void* GPSForm::receive(void *arg)
{
.....
}
void* GPSForm::show_gps_info(void *arg)
{
.......
}
可make时出现了这种错误:
gpsform.cpp:134: 错误:argument of type ‘void* (GPSForm::)(void*)’ does not match ‘void* (*)(void*)’
gpsform.cpp:135: 错误:argument of type ‘void* (GPSForm::)(void*)’ does not match ‘void* (*)(void*)’
单纯终端程序也是这样使用pthread的, 用g c c 编译通过,为什么用在q t 中用g++就有问题了呢?
请高手指点我该怎么改正.
不甚感激!
[ 此贴被XChinux在2006-05-31 08:47重新编辑 ]