gcc 编译pthread失败问题

问题描述

/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参数即可!
在这里插入图片描述

发布了147 篇原创文章 · 获赞 4 · 访问量 6815

猜你喜欢

转载自blog.csdn.net/weixin_43833642/article/details/103844253