cannot convert from type void*(classname::) () to type void*(*)(void*)

Viewed 8034
class Scoreget{
    private:
        //some variables
    public:
        Scoreget(){
            //something here
        }

        void* basicgetscore(){
            //somthing here
        }

        void getscore(Scoreget s){
            pthread_t t;
            if(pthread_create(&t,NULL,s.basicgetscore,NULL)==-1){
               printf("Error 3\n");
               exit(3);
            }
            void *a;
            if(pthread_join(t,&a)==-1){
               printf("Error \n);
               exit(4);
            }
        }
};

I am trying to run a separate thread for calling a function,because it uses a call to execl(), and thus will stop my program (I am on windows and cannot use fork()). Combining threading with classes is giving me hard times.

From some googling I understood I need to make that last function friend or static and use some sort of this pointer. I have tried on my part but pieces are not fitting together. I am even unable to change the error type. Its frustrating me now. Getting same error:

cannot convert Scoreget::basicgetscore from type void*(Scoreget::)() to type void* (*) (void *)

3 Answers
Related