pthread库不是Linux系统默认的库,连接时需要使用库libpthread.a,在编译中要加-lpthread(放在命令最后)。
[kou@localhost practive]$ gcc creat.c
/tmp/ccPULtaF.o:在函数‘main’中:
creat.c:(.text+0x58):对‘pthread_create’未定义的引用
collect2: 错误:ld 返回 1
[kou@localhost practive]$ gcc creat.c -lpthread