[p_thread] Erreur de prototype?
Bonjour !
Je commence à m'interesser de près aux p_threads mais j'ai déjà un problème, je teste le premier code du site d'Emmanuel Delahaye pour voir si mon gcc peut compiler et donc si je peux continuer à lire.
GCC me renvoie ça :
Code:
1 2 3
| /tmp/ccYJWei2.o : Dans la fonction "main":main.c:(.text+0x79): réfèrence indéfinie vers « pthread_create »
:main.c:(.text+0x9c): réfèrence indéfinie vers « pthread_create »
collect2: ld a retourné 1 code d'état d'exécution |
Le code est :
Code:
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 34 35
| /* ATTENTION CODE ERRONE */
#include <stdio.h>
#include "pthread.h"
static void *task_a (void *p_data)
{
puts ("Hello world A");
(void) p_data;
return NULL;
}
static void *task_b (void *p_data)
{
puts ("Hello world B");
(void) p_data;
return NULL;
}
int main (void)
{
pthread_t ta;
pthread_t tb;
puts ("main init");
pthread_create (&ta, NULL, task_a, NULL);
pthread_create (&tb, NULL, task_b, NULL);
puts ("main end");
return 0;
} |
Pourtant j'ai le fichier p_thread.h dans mon disque.
Je précise que je suis sous Linux, POSIX c'est portable non ?
Merci pour vos réponses.
Kr00pS