2010-12-01 123 views
2

嗨,我收到以下警告請幫助我。警告:不兼容的指針類型?

傳遞「在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;; 
} 
+1

「connected」參數是什麼類型? – 2010-12-01 06:57:37

回答

5

function必須返回一個void *。有關更多詳細信息,請參閱pthread_create(3)手冊頁。

+0

要從`function`中返回一個`void *`,你可以在`function`的任何地方調用`pthread_exit(void *)`,通常使用`return`。 – Kevin 2014-03-24 17:14:36

相關問題