Home

Published

- 1 min read

undefined reference to `sem_init`

img of undefined reference to `sem_init`

The solution for this is noted below

undefined reference to sem_init

Solution

   If you are on a linux system, you will need to compile and link with
the -pthread flag to link the pthreads library.


$ gcc -pthread FileName.c

Try other methods by searching on the site. That is if this doesn’t work