synchronize processes

hi.
i am writing a c program under bash shell.

i would like to use semaphore functions like sem_wait(), sem_post()
and i included <semaphore.h> and it compailes fine
but when i try to run it gives me an error "undefined reference to sem_wait() , sem_post() , sem_init()"

what have i missed ?

thats a linker problem

try adding -lrt to compilation

it helped.
thanks a lot.