/tmp/ccz11fg4.o: In function `main':
firstCode.c:(.text+0x24): undefined reference to `sem_open'
firstCode.c:(.text+0x34): undefined reference to `sem_post'
firstCode.c:(.text+0x4c): undefined reference to `sem_wait'
Link with pthread library.
compile with -pthread
gcc filename.c -o file.out -lpthread
Works on Ubuntu!