gcc编译出现undefined reference to ‘pthread_create‘

gcc编译出现undefined reference to ’pthread_create‘和 undefined reference to ’pthread_join‘
代码中已经有#include <pthread.h>

解决方法

在编译命令中加上-lpthread

gcc -Wall test.c -o test

改为

gcc -Wall -lpthread test.c -o test

猜你喜欢

转载自blog.csdn.net/weixin_45184581/article/details/131224376