红联Linux门户
Linux帮助

报错undefined reference to'pthread_reate'

发布时间:2010-09-21 14:28:31来源:红联作者:yezhubenyue
#include
#include
#include
#include
#include
void *myThread(void *arg)
{
printf("thread ran\n");
pthread_exit(arg);
}
int main()
{
int ret;
pthread_t mythread;
ret=pthread_create(&mythread,NULL,myThread,NULL);//为什么会报错啊
if(ret !=0)
{
printf("can't create pthread(%s)\n",strerror(errno));
exit(-1);
}
return 0;
}
[attach]32200[/attach]
为什么会报错啊。。那个pthread.h头文件 明明是有的!!!

[attach]32201[/attach]
文章评论

共有 5 条评论

  1. yezhubenyue 于 2010-09-21 22:27:53发表:

    恩,,行了。。谢谢楼上的~~~~~~~~~

  2. yezhubenyue 于 2010-09-21 22:27:25发表:

    恩,,行了。。谢谢楼上的~~~~~~~~~

  3. MemoryZA 于 2010-09-21 20:36:18发表:

    路过,期待解答

  4. deepwhite 于 2010-09-21 18:56:27发表:

    需要 pthread 库,试试:

    gcc test.c -lpthread

  5. yezhubenyue 于 2010-09-21 14:28:55发表:

    等待解答!!!!!!!!!!!!!!!!