BUG :MFC工程中使用CCriticalSection类定义同步对象时, 为什么需要include <Afxmt.h>?

记下自己的BUG:2013-10-18

现场描述:

      在MFC工程中,在一个自定义类中定义一个CCriticalSection对象m_cs,用来做同步处理使用;

      结果编译时:出现如下等错误:

g:\te\diomsserver_10_18\dlgremotes.h(40) : error C2146: syntax error : missing ';' before identifier 'm_cs'
g:\te\diomsserver_10_18\dlgremotes.h(40) : error C2501: 'CCriticalSection' : missing storage-class or type specifiers
g:\te\diomsserver_10_18\dlgremotes.h(40) : error C2501: 'm_cs' : missing storage-class or type specifiers

 

解决方法:在定义该CCriticalSection对象的头文件中, 包含头文件<Afxmt.h>

事件分析:(目前未知,待补充)

    

posted @ 2013-10-18 10:37  xiaoxiaoyusheng  阅读(1408)  评论(0编辑  收藏  举报