今天在写线程测试程序(pthread_create)时出现如下问题,

Debian下undefined reference to ‘pthread_create’问题解决

明明在头文件中包含了<pthread.h>,但是仍然提示找不到函数 pthread_create 和 pthread_join,查资料得知,

pthread不是linux下的默认库,也就是在链接的时候,无法找到pthread库文件各个函数入口地址,于是链接会失败。

解决方法,在进行gcc编译的时候,附加上 -lpthread 参数。

Debian下undefined reference to ‘pthread_create’问题解决

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
  • 2021-08-19
  • 2021-08-04
猜你喜欢
  • 2022-01-08
  • 2022-12-23
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案