1
我正在写pthreads的类,它的头文件和.cpp定义文件。pthread运行功能私人类
在.hi有:
class test
{
public:
int a;
...
private:
typedef void (*myfunc)(void *p);
static myfunc pthreadRun;
}
在的.cpp我有:
...
typedef void (*myfunc)(void *p);
myfunc test::pthreadRun
{
this->a = 10;
pthread_exit(NULL);
}
...
我得到一个错误:void (* test::pthreadRun)(void*)
不是class test
静态成员,和一堆其他错误也是,但这是第一个。
我很困惑,因为它是静态的:/
pthreadRun
是pthread_create()
我缺少的是线程运行功能?
Look [here](http://stackoverflow.com/questions/1151582/pthread-function-from-a-class)。你可以不要使用私有方法,至少不要这样... – 2013-03-01 10:48:57
你不能用typedef声明一个函数。 – 2013-03-01 10:53:56