Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Unable to find definition for CComCriticalSection class

Unable to find definition for CComCriticalSection class

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++comsysadmin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    act_x
    wrote on last edited by
    #1

    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 get

    1>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-int

    The definition for CComCriticalSection exists in atlcore.h which is included . Any help is appreciated

    Engineering is the effort !

    M 2 Replies Last reply
    0
    • A act_x

      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 get

      1>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-int

      The definition for CComCriticalSection exists in atlcore.h which is included . Any help is appreciated

      Engineering is the effort !

      M Offline
      M Offline
      Maxwell Chen
      wrote on last edited by
      #2

      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 { };
      #endif

      PS: I don't have VC++ at home now. Sorry!

      Maxwell Chen

      1 Reply Last reply
      0
      • A act_x

        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 get

        1>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-int

        The definition for CComCriticalSection exists in atlcore.h which is included . Any help is appreciated

        Engineering is the effort !

        M Offline
        M Offline
        Maxwell Chen
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups