launch a thread from a class

Hi! I'm trying to launch some threads from an object with methods. I need the thread can access to some variable and synchronization parameter defined like atributes of the class. here is an example:

class CameraClass{
public:
//Constructor
CameraClass();
//Destructor
~CameraClass();

bool launchUpdate(DWORD Period){//begin frame QueueTimer
HANDLE hTimerQueue = NULL;
hTimerQueue = CreateTimerQueue();
CreateTimerQueueTimer( &hTimer,hTimerQueue
,receiverThread,0,0,
Period,WT_EXECUTEINTIMERTHREAD);
}

bool launchCalculation(){//begin frame processing thread
hreceivThread = CreateThread(NULL,0,receiverThread, (void*)&hnd, 0, NULL);
}
private:
HANDLE hcalcThread;
HANDLE hTimer;
//Events
static HANDLE g_newblock;//event new block
static HANDLE g_newdata;//envent new data
};

in the function timer I use g_newblock to synchronize the timer with the thread, but wen I complile i get this error:
error LNK2001: unresolved external symbol "private: static void * CameraClass::g_newdata"
any Idea?
thanks!
When you use class static member data, not only do you have to define it in the header file, you also must define it in the implementation.

Sample header file:
1
2
3
4
class Demo
{
    static int count;
};


Sample body:
1
2
3
#include "Demo.hpp"

int Demo::count = 3;
Topic archived. No new replies allowed.