undefined reference to `pthread_create'

Hi

I wanted to learn communication between threads and I used a simple example but
I faced with this error while I have a sofware that uses this functions without
any problem
so would you please help me to know the reason
thanks for your help and great favor.

#include <pthread.h>
#include <stdio.h>

void *hello_world (void *arg)
{

printf \("Hello world\\n"\);
return NULL;

}

int main (int argc, char *argv[])
{
pthread_t hello_id;
int status;

status = pthread_create \(&hello_id, NULL, hello_world, NULL\);
if \(status != 0\)
    //err_abort \(status, "Create thread"\);
status = pthread_join \(hello_id, NULL\);
if \(status != 0\)
   // err_abort \(status, "Join thread"\);
return 0;

}

/tmp/cceZX3sJ.o(.text+0x47): In function `main':
: undefined reference to `pthread_create'
/tmp/cceZX3sJ.o(.text+0x60): In function `main':
: undefined reference to `pthread_join'
collect2: ld returned 1 exit status

I had one more question
I read in docs that when the parent thread terminates the child threads would be terminated too
but we can change the priority of a thread so is it possible to give a thread a priority more
than parent's. and can a parent terminates one of its child that has priority more or equal to its priority?

thanks

Best Regards.

how did you compile this code. use the pthread library

cc -o outputfile c_code_file -lpthread

I was missing the -lpthread option.
Thanks