在头文件中定义了一个模板类
typedef CTypedPtrList<CObList, CStudent*> CStudentList;
然后在程序中定义
CStudentList m_stuentList;
以及
CStudentList* GetList()
{ return &m_studentList; }程序中还有
m_studentList.GetHeadPosition()编译的时候这两个地方出错
出错信息为:
error C2065: 'm_studentList' : undeclared identifier
error C2065: 'm_studentList' : undeclared identifier
error C2228: left of '.GetHeadPosition' must have class/struct/union type
fatal error C1903: unable to recover from previous error(s);
stopping compilation请问是不是少了什么??
应该代码没有问题呀???
(已经在StdAfx.h中加入#include<afxtempl.h>)
typedef CTypedPtrList<CObList, CStudent*> CStudentList;
然后在程序中定义
CStudentList m_stuentList;
以及
CStudentList* GetList()
{ return &m_studentList; }程序中还有
m_studentList.GetHeadPosition()编译的时候这两个地方出错
出错信息为:
error C2065: 'm_studentList' : undeclared identifier
error C2065: 'm_studentList' : undeclared identifier
error C2228: left of '.GetHeadPosition' must have class/struct/union type
fatal error C1903: unable to recover from previous error(s);
stopping compilation请问是不是少了什么??
应该代码没有问题呀???
(已经在StdAfx.h中加入#include<afxtempl.h>)
CTypedPtrList<CObList, CStudent*> CStudentList;
1:看看拼写对马?
2:看看你的定义对马?
.....
上面说得对,拼写错了继续提问:
已经定义过了
CStudentList * m_pList
然后在程序中使用
m_pList=GetDocument()->GetList;编译出错信息为:
error C2440: '=' : cannot convert from 'class CTypedPtrList<class CObList,class CStudent *> *(__thiscall CStuDoc::*)(void)' to 'class CTypedPtrList<class CObList,class CStudent *> *'
There is no context in which this conversion is possible这是什么意思????