void thread()
{
int i;
for(i=0;i<3;i++)
printf("This is a pthread.\n");
}
int main(void)
{
pthread_t id;
int i,ret;
ret=pthread_create(&id,NULL,(void *) thread,NULL);
}
为什么编译时总是提示pthread_create()有错
错误提示是这样的:
error: invalid conversion from ‘void*’ to ‘void* (*)(void*)’
error: initializing argument 3 of ‘int pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*), void*)’
...全文
293打赏收藏
linux下创建线程的问题
void thread() { int i; for(i=0;i<3;i++) printf("This is a pthread.\n"); } int main(void) { pthread_t id; int i,ret; ret=pthread_create(&id,NULL,(void *) thread,NULL); } 为什么编译时总是提示pthread_create()有错 错误提示是这样的: error: invalid conversion from ‘void*’ to