当前位置: 代码迷 >> 综合 >> undefined reference to 'pthread_create' 错误
  详细解决方案

undefined reference to 'pthread_create' 错误

热度:40   发布时间:2024-01-10 05:49:44.0

Linux应用程序中,创建多线程时出现如下错误:

undefined reference to 'pthread_create'


问题原因:

没有包含pthread库(该库非Linux系统默认的库,需手动添加)。


解决办法:

makefile 中加上 -lpthread,同时源文件中包含<pthread.h> 头文件。




  相关解决方案