Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是我的生成文件:
program : program.o gcc -o program program.o program.o : program.c library.h gcc -c program.c
在“library.h”中,我有标题,但信号量有问题。它说“对 sem_open、sem_post、sem_wait 的未定义引用......”
您需要链接到 pthread 库 - libpthread. 尝试将链接命令更改为
libpthread
program : program.o gcc -pthread -o program program.o