Following is my program,
My header file,
Expand|Select|Wrap|Line Numbers
- class Test
- {
- private:
- ........ some declarations......
- public:
- Test();
- ~Test();
- int AnotherFunc();
- //my thread function
- static DWORD WINAPI threadFunc(LPVOID);
- }
Expand|Select|Wrap|Line Numbers
- int iGlobal = 0;
- Test::Test()
- {
- ......some processes and declarations....
- HANDLE hThrd = CreatThread(NULL, 0, threadFunc, NULL, 0, NULL);
- .........some other processes.......
- CloseHandle(hThrd);
- }
- int Test::AnotherFunc()
- {
- ........
- return 0;
- }
- DWORD WINAPI Test::threadFunc(LPVOID lpArgs)
- {
- iGlobal = 0;
- .....it does some processs......
- if(iGlobal == 1)
- AnotherFunc();
- return 0;
- }
If I try to declare iGlobal in my Test class, I get the error message "member Test::iGlobal cannot be used without an object".
Can somebody help me with these two errors and explain these errors....