CreateThread calls class member function 
Author Message
 CreateThread calls class member function

In this ActiveX class below I was trying to add a static member variable,
m_Var and an ordinary member function, FunctionToCreateThread, which calls a
thread function, Thread1.  In Thread1 it will change value of m_Var.

Visual Studio6 gave link error: "error LNK2001: unresolved external symbol
"private: m_Var..." something like that.

Does anyone knows why this is a problem?

Thank you very much!

class ATL_NO_VTABLE CTestX :
public CComObjectRootEx<CComSingleThreadModel>,
public IDispatchImpl<ITestX, &IID_ITestX, &LIBID_TestLib>,
public CComControl<CTestX>,
...
public CProxy_ITestXEvents< CTestX >
{
...
private:
    static int m_Var;
    static void Thread1();
    void FunctionToCreateThread();
...

Quote:
}



Mon, 10 Jan 2005 23:26:02 GMT  
 CreateThread calls class member function
did you have this line in you file ?

int CProxy_ITestXEvents< CTestX >::m_Var;


Quote:
> In this ActiveX class below I was trying to add a static member variable,
> m_Var and an ordinary member function, FunctionToCreateThread, which calls
a
> thread function, Thread1.  In Thread1 it will change value of m_Var.

> Visual Studio6 gave link error: "error LNK2001: unresolved external symbol
> "private: m_Var..." something like that.

> Does anyone knows why this is a problem?

> Thank you very much!

> class ATL_NO_VTABLE CTestX :
> public CComObjectRootEx<CComSingleThreadModel>,
> public IDispatchImpl<ITestX, &IID_ITestX, &LIBID_TestLib>,
> public CComControl<CTestX>,
> ...
> public CProxy_ITestXEvents< CTestX >
> {
> ...
> private:
>     static int m_Var;
>     static void Thread1();
>     void FunctionToCreateThread();
> ...
> }



Mon, 10 Jan 2005 23:50:54 GMT  
 CreateThread calls class member function

Quote:
> did you have this line in you file ?

> int CProxy_ITestXEvents< CTestX >::m_Var;

No.  Could you tell me what it is for?  Thanks.


Thu, 13 Jan 2005 06:51:39 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Calling Parent class member function

2. Calling C++ Class Member Functions from C

3. calling template member function in template class

4. Calling another class's member function from OnReceive

5. calling template member function in template class

6. Templated class - calling a member function - How?

7. Calling class member functions from a new thread

8. Calling convention for MFC class member functions

9. Calling member functions of another class

10. Call member function of class MainFrm

11. Calling a base classes member function

12. CreateThread and member functions

 

 
Powered by phpBB® Forum Software