I have been trying to fix/find a solution for an hour or so for this.
Basically I have:
CCriticalSection pCS;
inside a class declaration, and then I use a CSingleLock like this:
CSingleLock pSL(&pCS);
pSL.Lock();
*Stuff happening here*
pSL.Unlock();
to lock and unlock the pCS. But initializing the CriticalSection seems to always end up in this:
c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxmt.h(82): error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject'
c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(535) : see declaration of 'CObject::operator ='
c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(509) : see declaration of 'CObject'
This diagnostic occurred in the compiler generated function 'CSyncObject &CSyncObject::operator =(const CSyncObject &)'
I have 4 worker threads in the program and I’m sending them the pointer to the class where the CCriticalSection is, and the threads are working on the CCriticalSection, aswell as the main thread. The threads use the pointer of the class to use the CSingleLock that uses the CCriticalSection.
For your information, the code also includes Direct2D but that shouldn’t be relevant.
Some help would be appreciated.
EDIT:
Just tried to make a new project with just:
#include <afxmt.h>
in it. It gave me exceptions. Is that normal? I’m using VC++ 2010 Professional.
SOLVED:
Had a CEvent up there aswell, so I thought I’d make it into a pointer as well, and whaddya you know. It fixed that problem. Now there’s an afxmt.h file giving me exceptions.
Had a CEvent up there aswell, so I thought I’d make it into a pointer as well, and whaddya you know. It fixed that problem. Now there’s an afxmt.h file giving me exceptions.