I'm still learning MFC, many don't understand, I ask,
I define a structure as a global variable, three classes to access this structure variables, are the main dialog box class, CWinThread threads, thread start dialog box class, this three class itself is also a mutual reference of header files, if the global structure body on the main dialog box class header file, can appear repeatedly misquoted, if on the CPP, the other two classes with extern struct * XXX, there will be "do not allow the pointer to incomplete type of class", should be how to deal with this problem? Please help the younger generation
CodePudding user response:
Why do you want to use global variables from the start the idea?
PParam this parameter can pass your structure to thread
CWinThread * AfxBeginThread (AFX_THREADPROC pfnThreadProc, LPVOID pParam)
UINT WorkForce (LPVOID lpParameter);//thread function declaration
Dialog box class can increase a public function
SetParam (value) structure
CodePudding user response:
Forget the global variable this way, unless necessary to use it!This is not a good habit
CodePudding user response:
There is something wrong with the incomplete type of class "structureCodePudding user response:
Said is