未定义对pthread_create pthread_join';在Linux中 尝试使用-pthread编译?在编译过程中使用带gcc的-lpthread标志还可以看到您可以使用-lpthread编译可能与尝试使用-pthread编译的副本?在编

未定义对pthread_create pthread_join';在Linux中 尝试使用-pthread编译?在编译过程中使用带gcc的-lpthread标志还可以看到您可以使用-lpthread编译可能与尝试使用-pthread编译的副本?在编,c,linux,C,Linux,未定义对pthread_create pthread_join';在Linux中 尝试使用-pthread编译?在编译过程中使用带gcc的-lpthread标志还可以看到您可以使用-lpthread编译可能与尝试使用-pthread编译的副本?在编译过程中使用带gcc的-lpthread标志还可以看到您可以使用-lpthread编译可能与 #include <stdio.h> #include <pthread.h> volatile int Licznik;

未定义对pthread_create pthread_join';在Linux中
尝试使用
-pthread
编译?在编译过程中使用带gcc的
-lpthread
标志还可以看到您可以使用-lpthread编译可能与尝试使用
-pthread
编译的副本?在编译过程中使用带gcc的
-lpthread
标志还可以看到您可以使用-lpthread编译可能与
#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;
}
/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