#include <stdio.h>
#include <pthread.h>
volatile int Licznik;
void * thread1 (void * v1){
while(1) Licznik++;
}
void * thread2 (void * v1){
while(1) printf("%d ", Licznik);
}
int main(){
pthread_t w1, w2;
pthread_create(&w1, NULL, thread1, NULL);
pthread_create(&w2, NULL, thread2, NULL);
sleep(5);
pthread_join(w1, NULL);
return 0;
}
The error is:
/tmp/ccfGEzAp.o: In function `main':
main1.c:(.text+0x6c): undefined reference to `pthread_create'
main1.c:(.text+0x87): undefined reference to `pthread_create'
main1.c:(.text+0xa7): undefined reference to `pthread_jo