gcc 编译pthread失败问题

狂风中的少年 提交于 2020-01-06 13:59:20

问题描述

/usr/bin/ld: /tmp/ccVz9LdA.o: in function `main':
test.c:(.text+0xec): undefined reference to `pthread_create'
/usr/bin/ld: test.c:(.text+0x11b): undefined reference to `pthread_join'
collect2: 错误:ld 返回 1

在这里插入图片描述

解决方法:

加上-lpthread参数即可!
在这里插入图片描述

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!