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

Linux编程时使用gcc编译.c出现以下问题

client.c:(.text+0x13e): undefined reference to `pthread_create'
collect2: ld 返回 1
 

解决方法如下:
只需在用gcc编译时加上-pthread选项即可。

原因:没有链接上pthread库


 

 

猜你喜欢

转载自blog.csdn.net/qq_40120951/article/details/85007525