不知道爲什麼,但是......什麼會導致錯誤簡單的解釋
的main.c:126:4:錯誤:無法轉換爲指針類型的main.c:126 :4:警告:從不兼容指針類型[默認啓用]傳遞'pthread_create'的參數3 /usr/include/pthread.h:225:12:note:expected'void *(*)(void )'但參數的類型是'void()(struct arrayslice)'
我已經正確原型化了這個函數,據我所知。
struct People{
int count;
int levels;
};
struct arrayslice *args = ¤t;
pthread_create(&thread, NULL, countall, (void*) &args);
這裏的東西是不正確的,你是不是給我們足夠的信息。 「pthread_create」的原型是什麼樣的?你正在向它傳遞錯誤的觀點。 我懷疑你傳遞了一個雙指針,當你應該傳遞一個指針時。 – RandomGuy
第三個參數是'countall',但你沒有包括它的聲明,那麼你怎麼能指望任何人回答你的問題? –
來吧,@RandomGuy,您可以在手冊頁上找到pthread_create的原型,並且此錯誤消息還提供了預期的類型。 –