[Linux] Linux下undefined reference to ‘pthread_create’问题解决

Posted 龙场驿

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Linux] Linux下undefined reference to ‘pthread_create’问题解决相关的知识,希望对你有一定的参考价值。

 

问题的原因:pthread不是Linux下的默认的库,也就是在链接的时候,无法找到phread库中函数的入口地址,于是链接会失败。

 

解决:在gcc编译的时候,附加要加 -lpthread参数即可解决。

以上是关于[Linux] Linux下undefined reference to ‘pthread_create’问题解决的主要内容,如果未能解决你的问题,请参考以下文章