分享

gcc编译出现 undefined reference to ‘pthread_create‘ 的解决方法

 流楚丶格念 2022-01-14

错误

今天写了个Linux多线程 报了下面的错
在这里插入图片描述

原因

由于pthread库不是标准linux库, gcc编译时候找不到

解决

编译语句后加上-lpthread ,添加这个线程库

gcc thread.c -lpthread 

在编译就没错啦
在这里插入图片描述

    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多