[Moved] how to use pthread in qt??
-
am using qt in windows. but i like to develop one linux application with the help of qt..... can anyone tell me how to use pthread in qt?? i got some few errors.. please dont mention to use QThreads... got two errors:
- error in third argument - pthread_create(&thread2,NULL,(void*)&even,NULL);
- undefined error while building. like undefiend error in pthread_mutex_lock....... in linux am using -lpthread, so how to add those libpthread.so.0 in qt..........
kindly help me soon .. its urgent..
thanks in advance,
shakthi -
Show the exact errors, not just your interpretation of them.
-
pthread_create(&thread1,NULL,(void*)&even,NULL);
error:
- invalid conversion from void* to (void*)()(void)
- initalizing argument in pthread_create(....)
the above are errors in first level
-
What type has "even"?
Just seems you need:
@pthread_create(&thread1,NULL,(void *)even,NULL);@ -
I think you need to pass in a function that accepts a void pointer:
@void even(void*);@Even if you don't use the pointer, the function has to accept it to match the function type expected by pthread_create
@void *(start_routine)(void)@
as stated in the "pthread_create man page":http://linux.die.net/man/3/pthread_create. If that doesn't fix it, please provide a zipped project with your code or code that shows the exact issue you have, so we can try and debug ourselves. -
Moved to the C++ Gurus forum, this has nothing to do with Qt.