编译出错: 对‘sem_init’未定义的引用 原因: 一般出错的原因是没有链接库导致的 解决方法: 在编译最后添加 -lpthread 例如: gcc -o test test.c -lpthread