So I am getting the error: \"undefined reference to sem_open()\" even though I have include the semaphore.h header. The same thing is happening for all my pthread function
The working option in Ubuntu is -lpthread. But if you work on suse or other systems the correct option is -lrt. Also the book Linux Programmin Interface mentions -lrt as the correct option.