i am trying to compile this code in C. I am using
 gcc -o -pthread test1.c
I am using Linux. Unfortunately I get:
undefined reference to `pthread_create'
 undefined reference to `thread_join'
  collect2: error: ld returned 1 exit status
When I try to compile:
    #include <stdio.h>
    #include <pthread.h>
    #include <stdlib.h>
    void* thread_func(void* parameter){
        int i =0;
        for(i=0; i<5;i++)
        {
            printf("%d\n", i);
        }
      return 0;
    }
 int main (int argc, char *argv)
 {
     pthread_t thread_handle;
     int ret = pthread_create(&thread_handle,0,thread_func,0);
     if(ret != 0) {
        printf("Create thread failed! error: %d",ret);
        return 1;
      }
      thread_join(thread_handle,0);
      return 0;
}
When I use the second solution from here: Undefined reference to pthread_create in Linux
I get another error. I am in the directory where my test1.c .
no input files
ADDIN ERRORS:
1)using gcc -o someFile -pthread test1.c
-undefined reference to `thread_join'
2)gcc -o -pthread test1.c
-undefined reference to `thread_join'
-undefined reference to `pthread_create'
3)gcc test1.c -o test1.o -I. -lpthread 
- undefined reference to `thread_join'
4)gcc -pthread -o test.c
- no input files
I would be grateful for help because I can't learn threads because I can't compile it.
 
     
     
     
     
    