Hey, just came across a small problem. I have a C++ object, which creates a new thread (within constructor). But the new thread runs a member function. This:
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) this->loopThread, NULL, 0, &threadID);
gives me this error:
"error C2440: ''type cast'' : cannot convert from ''overloaded-function'' to ''LPTHREAD_START_ROUTINE''
None of the functions with this name in scope match the target type"
Now I did manage to get this to compile, by casting to void:
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) (void) this->loopThread, NULL, 0, &threadID);
However, the function doesn''t actually run! I suppose I could have the loopThread function seperate from the object, but I thought it would be better to keep this nice and object orientated =)
Anyone tell me how to get around this, without creating seperate outside functions?