警告:不兼容的指针类型?
问题描述:
嗨,我收到以下警告请帮助我。警告:不兼容的指针类型?
传递“在pthread_create” 的参数3从兼容的指针类型
我的代码是:
int function(int *);
int main()
{
pthread_t thread_a;
pthread_create(&thread_a,NULL, function,&connected);
int function(int *fnd)
{
int bytes_recieved;;
}
答
function
必须返回一个void *
。有关更多详细信息,请参阅pthread_create(3)
手册页。
+0
要从`function`中返回一个`void *`,你可以在`function`的任何地方调用`pthread_exit(void *)`,通常使用`return`。 – Kevin 2014-03-24 17:14:36
“connected”参数是什么类型? – 2010-12-01 06:57:37