#include <afxtempl.h> // MFC templates
我的MFC程序是靠Wizard生成的,一句都没改。后来由于需要要在doc类中加入一个"CArray<CPoint,CPoint> m_pointArray;“
变异完后出现如下错误:
d:/program files/workspace/scribble/scribbledoc.h(21) : error C2143: syntax error : missing ';' before '<'
d:/program files/workspace/scribble/scribbledoc.h(21) : error C2501: 'CArray' : missing storage-class or type specifiers
d:/program files/workspace/scribble/scribbledoc.h(21) : error C2059: syntax error : '<'
d:/program files/workspace/scribble/scribbledoc.h(21) : error C2238: unexpected token(s) preceding ';'
.
.
.
经过查找资料发现stdafx.h中默认的是不导入<afxtempl.h>包的。而该包则是负责MFC模板类的包,在该头文件中加上
“#include <afxtempl.h> // MFC templates”
以后在进行编译就没有问题了。
希望能对大家有所帮助。