我做了所有必要的配置,比如包括Pthread库和头文件......
错误是:
error C3867: 'FunctionClass::calledfunction': function call missing argument list; use '&FunctionClass::calledfunction' to create a pointer to member
Run Code Online (Sandbox Code Playgroud)
这是导致错误的示例:
class FunctionClass
{
public:
void * calledfunction( void *);
/*
this is the definition of the function in the FunctionClass.cpp
void * FunctionClass::calledfunction( void *)
{
//do sth;
}
*/
};
int main(void)
{
pthread_t process_m;
FunctionClass *obj = new FunctionClass ();
int nbr= 5;
if(pthread_create(&process_m,NULL,obj->calledfunction,(void *)nbr)< 0)
{
std::cout << "thread1";
}
}
Run Code Online (Sandbox Code Playgroud)
什么可能导致错误?我尊重函数pthread_create的语法......但是我找不到这个错误的原因!