Hi.

I am working on a program that utilizes several threads (worker threads). I want to implement a class-safe thread synchronization. In his book, Prosise uses CCriticalSection and CEvent.

I would like to use CCriticalSection with CSingleLock. However, Visual C++ outputted errors when I declared the CCriticalSection and CSingleLock. For example:

-----
// this is in the document class (single)
...
private:
...
CCriticalSection m_cs;
CSingleLock m_sl;
...
};
-----

Visual C++ outputted similar errors referring to both classes. Here are the errors:

-----
d:\C++\MyApp\MyApp.h(96): error C2146: syntax error : missing ';' before identifier 'm_cs'
d:\C++\MyApp\MyApp.h(96): error C2501: 'CMyAppDoc::CCriticalSection' : missing storage-class or type specifiers
d:\C++\MyApp\MyApp.h(96): error C2501: 'CMyAppDoc::m_cs' : missing storage-class or type specifiers
d:\C++\MyApp\MyApp.h(97): error C2146: syntax error : missing ';' before identifier 'm_sl'
d:\C++\MyApp\MyApp.h(97): error C2501: 'CMyAppDoc::CSingleLock' : missing storage-class or type specifiers
d:\C++\MyApp\MyApp.h(97): error C2501: 'CMyAppDoc::m_sl' : missing storage-class or type specifiers
-----

I tried declaring both variable as protected and global. I saw the same errors.

Is there something specific that I need to add to the document interface as in maybe #include <something>?

Thanks,
Kuphryn