Unable to find definition for CComCriticalSection class
-
Hi , I have a simple File - logging class which I plan to use in a COM Server. I also have a template based Singleton Class ( CSingleTonT) that takes this object such that there is only 1 instance of this in the system. I am trying to add a CComCriticalSection protected member variable and inspite of including the header for this I am getting a compilation error
#ifndef _CLOGGER_H #define _CLOGGER_H #include "atlbase.h" #include "atlcore.h" .. .. class CLogger { public : // All methods here protected : bool m_bInitialized ; ofstream m_logfile; CComCriticalSection myCS ; string strFileName ; };
Now these are the compilation errors I get1>d:\code\com\clogger.h(172) : error C2146: syntax error : missing ';' before identifier 'myCS'
1>d:\code\com\clogger.h(172) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\code\com\clogger.h(172) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intThe definition for CComCriticalSection exists in atlcore.h which is included . Any help is appreciated
Engineering is the effort !
-
Hi , I have a simple File - logging class which I plan to use in a COM Server. I also have a template based Singleton Class ( CSingleTonT) that takes this object such that there is only 1 instance of this in the system. I am trying to add a CComCriticalSection protected member variable and inspite of including the header for this I am getting a compilation error
#ifndef _CLOGGER_H #define _CLOGGER_H #include "atlbase.h" #include "atlcore.h" .. .. class CLogger { public : // All methods here protected : bool m_bInitialized ; ofstream m_logfile; CComCriticalSection myCS ; string strFileName ; };
Now these are the compilation errors I get1>d:\code\com\clogger.h(172) : error C2146: syntax error : missing ';' before identifier 'myCS'
1>d:\code\com\clogger.h(172) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\code\com\clogger.h(172) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intThe definition for CComCriticalSection exists in atlcore.h which is included . Any help is appreciated
Engineering is the effort !
Browse into "
atlcore.h
", and check if there is any condition around the declaration of that class type. For example:#if (WINNT_VERSION > 5001)
class HelloEx { };
#else
class Hello { };
#endifPS: I don't have VC++ at home now. Sorry!
Maxwell Chen
-
Hi , I have a simple File - logging class which I plan to use in a COM Server. I also have a template based Singleton Class ( CSingleTonT) that takes this object such that there is only 1 instance of this in the system. I am trying to add a CComCriticalSection protected member variable and inspite of including the header for this I am getting a compilation error
#ifndef _CLOGGER_H #define _CLOGGER_H #include "atlbase.h" #include "atlcore.h" .. .. class CLogger { public : // All methods here protected : bool m_bInitialized ; ofstream m_logfile; CComCriticalSection myCS ; string strFileName ; };
Now these are the compilation errors I get1>d:\code\com\clogger.h(172) : error C2146: syntax error : missing ';' before identifier 'myCS'
1>d:\code\com\clogger.h(172) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\code\com\clogger.h(172) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intThe definition for CComCriticalSection exists in atlcore.h which is included . Any help is appreciated
Engineering is the effort !
act_x wrote:
CComCriticalSection myCS ;
I just created an ATL server project by Wizrad, and it compiles fine. The class
CComCriticalSection
is in the namespace ATL. Maybe you should do this way if your class is not derived from built-in ATL classes:ALT::CComCriticalSection myCS;
Maxwell Chen