首页 > 学院 > 开发设计 > 正文

pthread_create 未定义的引用

2019-11-08 02:11:52
字体:
来源:转载
供稿:网友

问题:Ubuntu环境在编译pthread_函数相关代码时,报如下错误:**

zhuqingping@ubuntu:~/Study/C/pthread$ gcc -o child_thread child_thread.c/tmp/ccXx2krL.o:在函数‘main’中:child_thread.c:(.text+0x5a):对‘pthread_create’未定义的引用child_thread.c:(.text+0x91):对‘pthread_join’未定义的引用collect2: error: ld returned 1 exit status

解决办法:在编译时明确指定链接库,在编译的最后添加 -lpthread即可


上一篇:封装

下一篇:LeetCode 1. Two Sum

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表