I've been working with examples of csapp 3rd edition, and I couldn't successfully compile given codes from csapp website with gcc.
The source code I've tried to compile was "signal1.c" which includes header file "csapp.h" split into source code "csapp.c".
I've been trying to compile "signal1.c" in several ways like "gcc csapp.h csapp.c signal1.c -o signal1" "gcc csapp.c signal1.c -o signal1"
but only error message says
/tmp/ccGJtkct.o: In function Pthread_create':
csapp.c:(.text+0x108a): undefined reference to
pthread_create'
/tmp/ccGJtkct.o: In function Pthread_cancel':
csapp.c:(.text+0x10bd): undefined reference to
pthread_cancel'
/tmp/ccGJtkct.o: In function Pthread_join':
csapp.c:(.text+0x10fb): undefined reference to
pthread_join'
/tmp/ccGJtkct.o: In function Pthread_detach':
csapp.c:(.text+0x112e): undefined reference to
pthread_detach'
/tmp/ccGJtkct.o: In function Pthread_once':
csapp.c:(.text+0x118f): undefined reference to
pthread_once'
/tmp/ccGJtkct.o: In function Sem_init':
csapp.c:(.text+0x11b8): undefined reference to
sem_init'
/tmp/ccGJtkct.o: In function P':
csapp.c:(.text+0x11e1): undefined reference to
sem_wait'
/tmp/ccGJtkct.o: In function V':
csapp.c:(.text+0x120a): undefined reference to
sem_post'
collect2: error: ld returned 1 exit status
I've checked if header file "csapp.h" doesn't include nor my computer doesn't have with it but it doesn't seem so.
What will be of right choice to compile this?
Thank you.