【问题标题】:warning:incompatible pointer type?警告:不兼容的指针类型?
【发布时间】:2010-12-01 06:53:19
【问题描述】:

您好,我收到以下警告,请帮助我。

传递“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;;
}

【问题讨论】:

  • connected 参数是什么类型的?

标签: c pthreads


【解决方案1】:

function 必须返回 void *。有关详细信息,请参阅 pthread_create(3) 手册页。

【讨论】:

  • 要从function 返回void *,您可以在function 中的任何位置调用pthread_exit(void *),您通常会使用return
【解决方案2】:

来自manual

function 必须接收并返回void *

【讨论】:

    猜你喜欢
    • 2015-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多