Linux编程时使用gcc编译.c出现以下问题pthread_create.c:(.text+0x76): undefined reference to `pthread_create'

错误:

pthread_create.c:(.text+0x76): undefined reference to `pthread_create’
collect2: error: ld returned 1 exit status
在这里插入图片描述

解决方法如下:

在这里插入图片描述
只需在用gcc编译时加上-pthread选项即可。

结果:
在这里插入图片描述

发布了131 篇原创文章 · 获赞 44 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/qq_38769551/article/details/103663044