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