关于pthread_create函数的问题

部分代码如下:
void * prin(void *)
{
cout<<"hello"<<endl;
}

returnvalue=pthread_create(thread,NULL,prin,NULL);
编译显示:Undefined Reference to pthread_create;这是为什么?
---------------------------------------------------------------

加参数 -lpthread 就可以了

pthread这个库不是默认得库

g++ -lpthread -o my.o my.c

Good luck

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus