40media compile error:c language in telnet(linux)
صفحه اصلي

compile error:c language in telnet(linux)



#include<stdio.h> #include<unistd.h> #include<stdlib.h> #include<pthread.h>  int count=0;  void *thread_function(void *arg) { while(count<10) { if(count%2==1) { count++; } else {sleep(1);} } }  int main(int argc,int *argv) {  int res;  pthread_t a_thread[2];  void *thread_result;  int n;  while(count<10) { if(count%2==0) {printf("%d",count);   count++; } else{sleep(1);} }  for(n=0;n<2;n++) {  pthread_create(&(a_thread[n]),NULL,thread_function,NULL);  }  while(count==9)  {pthread_join(a_thread[0],&thread_result);  }  while(count==10)  {  pthread_join(a_thread[1],&thread_result);  }  printf("%d",count);  return 0;  } 

in telnet,linux

i write gcc za.c

error list: undefined reference to pthread_create,pthread_join in function 'main'

//why??


How do I pass a Python Variable to Bash?

1:

read from file after calling lseek64 - Linux
You need to link with the Pthreads library:. Basic heap usage statistics in GCC on 64-bit platform
gcc -lpthread za.c 
Segmentation Fault in prime number sieve

78 out of 100 based on 43 user ratings 438 reviews