在编译中要加 -lpthread或-pthread参数(不同版本的gcc可能不一样,man gcc可以查阅对应参数)。

例如:在加了头文件#include <pthread.h>之后执行 pthread.c文件,需要使用如下命令:

    gcc -lpthread -o thread thread.c

    gcc -pthread -o thread thread.c

这种情况类似于<math.h>的使用,需在编译时加 -m 参数。

相关文章:

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