我在头文件中定义了一个CList类的变量
可是编译的时候却通不过
WHY啊??
CList<CTime,CTime> m_TimeList;
 
:\我的工程vc++6.0版\general_classview.h(64) : error C2143: syntax error : missing ';' before '<'
e:\我的工程vc++6.0版\general_classview.h(64) : error C2501: 'CArray' : missing storage-class or type specifier
 
是不是还要设定头文件才能用CList等等啊???

解决方案 »

  1.   

    是,你要加入#include <afxtempl.h>
      

  2.   

    #include <afxtempl.h>
    需要增加这个头文件包含。
      

  3.   

    CList、CArray这些模板类都在这个头文件中申明。
      

  4.   

    应该这么定义CList:
    CList<CTime,CTime &> m_TimeList;
    或者
    CList<CTime *,CTime *> m_TimeList;
    尖括号中不能两个都用CTime
      

  5.   

    这个定义为什么不能通过?
    typedef struct PortList{
        u_int ServerPort;
    u_int UserPort;
    }PORTLIST,*PPORTLIST;typedef struct UserTable{
       IPAddr UserIP;
       CList<PORTLIST,PORTLIST &> Port;
       struct UserTable *Next;
       struct UserTable *Prev;
    }USERGROUP,*PUSERGROUP;
      

  6.   

    加入#include <afxtempl.h>