Bonjour,
je n'arrive pas à compiler ce petit programme servant a illustrer mon problème :
Code :
- #include <iostream>
- #include <pthread.h>
- using namespace std;
- static pthread_mutex_t mutex;
- class Foo
- {
- string f;
- Foo();
- ~Foo();
- void* affiche(void *p_data);
- };
- Foo::Foo ()
- {
- string tmp("Je suis Foo" );
- f=tmp;
- }
- Foo::~Foo()
- { }
- void* Foo::affiche(void *p_data)
- {
- cout << f << endl;
- return NULL;
- }
- int main()
- {
- pthread_mutex_init (&mutex, NULL);
- pthread_t thrd1;
- Foo f;
- pthread_create(&thrd1,NULL,f.affiche,NULL);
- pthread_join(thrd1, NULL);
- cout << "Fin" << endl;
- return 0;
- }
|
Ce programme ne fait pas grand chose, il sert juste d'illustration au problème que je rencontre.
Pourquoi le compilo me dit-il :
fichier.cpp:40: error: argument of type `void*(Foo::)(void*)' does not match `void*(*)(void*)'
Et comment résoudre mon problème.
D'avance merci !
TuRn3r
Message édité par turn3r le 09-05-2006 à 15:29:16
---------------
Les ventes de véhicules neufs ont chuté de 7%, y'en a marre des pirates qui téléchargent illégalement des voitures sur internet !!