Subj : meaning of error message? To : comp.programming.threads From : Huub Date : Sun Jun 05 2005 03:07 pm Hi, Using Slackware 10, kernel 2.6.11 and gcc-3.3.4, I'm trying to pass an argument with a thread, but get this error: "error: invalid conversion from `void (*)(void*)' to `void*(*)(void*)' " on the line "rc = pthread....". This is the code (I changed it into a main() function to have it compilable). #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "MotorenAansturing.h" #include "ftapi/ftapi.h" #include #include using namespace std; using namespace ftapi; int motor1; int snelheid1, snelheid2; //char *snelheden[t]; string device(""); ft_if_conn connection = FT_IC_LIB_USB; /* Set all interface outputs */ IfOutputs out; /* Lezen van interface */ IfInputs in; //Mastermodule mamo; void MotorThread(void *threadid) { cout << "Start MotorThread" << endl; int *id_ptr, task_id; time_t start; time_t current; id_ptr = (int *)threadid; task_id = *id_ptr; try { /* Open een verbinding naar de ft interface */ auto_ptr fti (ftGetIfFromFactory(device, connection)); FtMotorSpeed mSpeed1(task_id); FtMotorSpeed mSpeed2(task_id); out.data[FT_MASTER] = 0xFF; out.setMotorSpeed(FT_MASTER, FT_M1, mSpeed1); out.setMotorSpeed(FT_MASTER, FT_M2, mSpeed2); while (difftime(current, start) < 3.0) { time(¤t); fti->writeAndReadAllData(out, in); } } catch (exception &x) { cout << x.what() << endl; } } int main(int argc, char *argv[]) { pthread_t threads[1]; int rc, t; int *task_ids[1]; t = 0; int motor1 = 1; int snelheid = 1; if (motor1 == -1 && snelheid == 1) { snelheid1 = -4; } else if (motor1 == 0 && snelheid == 1) { snelheid1 = 0; } else if (motor1 == 1 && snelheid == 1) { snelheid1 = 4; } rc = pthread_create(&threads[t], NULL, MotorThread, (void *)task_ids[t]); pthread_exit(NULL); return EXIT_SUCCESS; } Thank you for helping. Huub .