How to run the following C program "Seeking Tutor" on Linux
$ ./seekingtutor
bash: ./seekingtutor: No such file or directory
While executing, you need to run it using ./seek
, not ./seekingtutor
as -o seek
outputs the executable with the name seek
The linker has shown errors collect2: error: ld returned 1 exit status
, so it did not output the executable.
It seems like it needs pthread
. So run gcc seekingtutor.c -o seek -lpthread
to compile it, and try. It works for me here.
https://man7.org/linux/man-pages/man3/sem_init.3.html says
Link with -pthread.