C++ Error linking in consumer file caused by static data field
问题 I want to use a static global variable as a mutex. When I try to compile the following code: //header file class __declspec(dllexport) StateConservator { private: StateConservator(); StateConservator(const StateConservator&); protected: const CString m_oldConf; CContainer& m_container; static bool x_mutex; public: StateConservator(CContainer& container, const CString& conf) : m_container(container) , m_oldConf(!x_mutex? container.GetConf():_T("")) { if(!x_mutex) { x_mutex= true; m_container