`
957803796_1
  • 浏览: 120468 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

undefined reference to 'pthread_create'

 
阅读更多

pthread 库不是 Linux 系统默认的库,连接时需要使用静态库 libpthread.a,所以在使用pthread_create()创建线程,以及调用 pthread_atfork()函数建立fork处理程序时,需要链接该库。

源文件,不要忘了加上头文件#include<pthread.h>
在编译中要加 -lpthread参数
#gcc test.c -o thread -lpthread

#cc test.c -lpthread

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics