我把这个东西加到我的CDocument的派生类里面怎么会出错呀?我已经把CLine的头“Line.h”加到派生类里了,还是不行。错误如下:
e:\sun\draw\drawdoc.h(18) : error C2143: syntax error : missing ';' before '<'
e:\sun\draw\drawdoc.h(18) : error C2501: 'CTypedPtrArray' : missing storage-class or type specifiers
e:\sun\draw\drawdoc.h(18) : error C2059: syntax error : '<'
e:\sun\draw\drawdoc.h(18) : error C2238: unexpected token(s) preceding ';'
DrawDoc.cpp
e:\sun\draw\drawdoc.h(18) : error C2143: syntax error : missing ';' before '<'
e:\sun\draw\drawdoc.h(18) : error C2501: 'CTypedPtrArray' : missing storage-class or type specifiers
e:\sun\draw\drawdoc.h(18) : error C2059: syntax error : '<'
e:\sun\draw\drawdoc.h(18) : error C2238: unexpected token(s) preceding ';'
DrawView.cpp
e:\sun\draw\drawdoc.h(18) : error C2143: syntax error : missing ';' before '<'
e:\sun\draw\drawdoc.h(18) : error C2501: 'CTypedPtrArray' : missing storage-class or type specifiers
e:\sun\draw\drawdoc.h(18) : error C2059: syntax error : '<'
e:\sun\draw\drawdoc.h(18) : error C2238: unexpected token(s) preceding ';'
Generating Code...
Error executing cl.exe.Draw.exe - 12 error(s), 0 warning(s)

解决方案 »

  1.   

    我现在的项目里面也用的这个类
    你在stdafx.h中添加下面的文件include即可
    #include <afxtempl.h>
      

  2.   

    直接在你要使用模板的文件里面假如#include<afxtempl.h>,一定行,我也碰到过同样的问题.
      

  3.   

    直接在你要使用模板的文件里面加入#include<afxtempl.h>,一定行,我也碰到过同样的问题.
      

  4.   

    谢谢了,我昨天也是发现是这个问题。后来我看了MSDN看见里面说必须要有<afxtempl.h>类,但是到stdafx.h里看看居然没有气死我了,这个破MFC