社区
C语言
帖子详情
underfined reference to 'pthread_create'
emblong
2015-04-27 03:27:51
谢谢,顺便问一下
make 时候出现 undefined reference to 'pthread_create'
但是,我头文件加了,编译的时候-lpthread也加了,问什么还会出现这样的错误
makefile 中这句话如下:
cc -c $^ -o $@ -I ./include -lpthread
...全文
128
5
打赏
收藏
underfined reference to 'pthread_create'
谢谢,顺便问一下 make 时候出现 undefined reference to 'pthread_create' 但是,我头文件加了,编译的时候-lpthread也加了,问什么还会出现这样的错误 makefile 中这句话如下: cc -c $^ -o $@ -I ./include -lpthread
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
emblong
2015-04-29
打赏
举报
回复
-lpthread 是在链接的时候加
mymtom
2015-04-28
打赏
举报
回复
把make的输出都贴出来吧,楼主问个问题,干嘛还藏着掖着!
此后三年
2015-04-27
打赏
举报
回复
引用 2 楼 a30037338 的回复:
cc -c $^ -o $@
-I
./include -lpthread 多了一个-l
应该是一个大写的 ‘i’
此后三年
2015-04-27
打赏
举报
回复
cc -c $^ -o $@
-I
./include -lpthread 多了一个-l
赵4老师
2015-04-27
打赏
举报
回复
LD_LIBRARY_PATH -L(lib目录) -l(lib名称)
undefined
reference
to 'p
thread
_
create
'问题解决
由于是Linux新手,所以现在才开始接触线程...undefined
reference
to 'p
thread
_
create
' undefined
reference
to 'p
thread
_join' 问题原因: p
thread
库不是 Linux 系统默认的库,连接时需要使用静态库 libpthrea
undefined
reference
to ‘p
thread
_
create
’问题解决
p
thread
库不是 Linux 系统默认的库,连接时需要使用静态库 libp
thread
.a,所以在使用p
thread
_
create
()创建线程,以及调用 p
thread
_atfork()函数建立fork处理程序时,需要链接该库。 问题解决: 在编译中要加 -...
C/C++ linux 多线程编程报错 :undefined
reference
to `p
thread
_
create
‘
aliven@Aliven:~$ g++ -o main -g testDemo.cpp /usr/bin/ld: /tmp/cci68K7i.o: in function `.../usr/include/c++/9/
thread
:126: undefined
reference
to `p
thread
_
create
' collect2: error: ld returned 1 exit stat
undefined
reference
to symbol' p
thread
_
create
@@GLIBC_2.2.5'
我在ubuntu16.04上迁移工程,遇到了这个错误。 p
thread
库不是Linux系统默认的库,链接时需要添加-p
thread
参数。 这里注意是链接那一步添加-p
thread
,而不是编译选项。...
/usr/bin/ld: /tmp/ccqI05MH.o: undefined
reference
to symbol ‘p
thread
_
create
@@GLIBC_2.2.5‘
在linux下,编写C程序用到了线程库。 由于p
thread
库不是Linux系统默认的库,连接时需要使用库libp
thread
.a,所以在编译中要加-lp
thread
参数: gcc xxxx.c -lp
thread
-o xxxx
C语言
69,336
社区成员
243,078
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章