bonjour tout le monde

bon voila j'ai un petit prb avec un thread sous linux

impossible de faire passe ce code la
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
 
void *my_thread_process (void * arg)
{
  int i;
 
  for (i = 0 ; i < 5 ; i++) {
    printf ("Thread %s: %d\n", (char*)arg, i);
    sleep (1);
  }
  pthread_exit (0);
}
 
main (int ac, char **av)
{
  pthread_t th1, th2;
  void *ret;
 
  if (pthread_create (&th1, NULL, my_thread_process, "1") < 0) {
    fprintf (stderr, "pthread_create error for thread 1\n");
    exit (1);
  }
 
  if (pthread_create (&th2, NULL, my_thread_process, "2") < 0) {
    fprintf (stderr, "pthread_create error for thread 2\n");
    exit (1);
  }
 
  (void)pthread_join (th1, &ret);
  (void)pthread_join (th2, &ret);
}
a chaque fois il me dis qu'il trouve pas cette fonction pourtant il trouve bien la libraire
il me marque comme erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
undefined reference to pthread_create
Code : Sélectionner tout - Visualiser dans une fenêtre à part
undefined reference to pthread_join
merci pour votre aide

bonne journee

kikoufr