使用CCriticalSection类的注意事项

在类中使用CCriticalSection变量时,必需要将CCriticalSection变量定义为全局变量和静态变量,否则将出现没有定义的错误。

如:

// a.h 文件

class A:public CWnd

{

private:

  static  CCriticalSection m_cs;

  ...

};


//a.cpp 文件

CCriticalSection   A:m_cs; // 初始化变量

...


原文地址:https://www.cnblogs.com/gavanwanggw/p/7223980.html