关于mfc文档与视图关系的 急

关于mfc文档与视图关系的 急在线等!
我定义了一个结构体字符数组,在文档类中。
想在视图类中使用。可是显示 编译错误!
错误提示 :D:\MSDev98\MyProjects\koma1993\clist.cpp(83) : error C2065: 'stu' : undeclared identifier
D:\MSDev98\MyProjects\koma1993\clist.cpp(83) : error C2109: subscript requires array or pointer type
D:\MSDev98\MyProjects\koma1993\clist.cpp(83) : error C2228: left of '.name' must have class/struct/union type
D:\MSDev98\MyProjects\koma1993\clist.cpp(84) : error C2109: subscript requires array or pointer type
D:\MSDev98\MyProjects\koma1993\clist.cpp(84) : error C2228: left of '.number' must have class/struct/union type
D:\MSDev98\MyProjects\koma1993\clist.cpp(85) : error C2109: subscript requires array or pointer type
D:\MSDev98\MyProjects\koma1993\clist.cpp(85) : error C2228: left of '.grades' must have class/struct/union type

在文档中定义结构体如下
struct student
{
char name[20];
char number[20];
char grades[20];
};
public:
virtual ~CKoma1993Doc();
student stu[15];
在视图类中这段列表代码就不执行
 for(int i=0;i<15;i++)
  {ListCtrl.InsertItem(i, "");
  ListCtrl.SetItemText(i,0, stu[i].name);
ListCtrl.SetItemText(i,1, stu[i].number);
ListCtrl.SetItemText(i,2, stu[i].grades);
}
 student stu[15] 这个结构体字符数组我定义过了啊 为啥就不对呢?
视图中我也 调用了对应的文档预处理! 真是不明白问题出在哪里?
 求教高手帮帮忙吧!
   
   
 

------解决方案--------------------
探讨

View中
CxxxxDoc* CxxxxView::GetDocument()
调用:
CxxxxDoc* pDoc = GetDocument();

------解决方案--------------------
D:\MSDev98\MyProjects\koma1993\clist.cpp(83) : error C2065: 'stu' : undeclared identifier
D:\MSDev98\MyProjects\koma1993\clist.cpp(83) : error C2109: subscript requires array or pointer type
D:\MSDev98\MyProjects\koma1993\clist.cpp(83) : error C2228: left of '.name' must have class/struct/union type
D:\MSDev98\MyProjects\koma1993\clist.cpp(84) : error C2109: subscript requires array or pointer type
D:\MSDev98\MyProjects\koma1993\clist.cpp(84) : error C2228: left of '.number' must have class/struct/union type
D:\MSDev98\MyProjects\koma1993\clist.cpp(85) : error C2109: subscript requires array or pointer type
D:\MSDev98\MyProjects\koma1993\clist.cpp(85) : error C2228: left of '.grades' must have class/struct/union type

通过错误判断 你的student stu[15]未定义, 可以采用1楼的方法,
也可以将你的结构体定义在view类的 class CXXXView:public CView 这行上面,然后向view类添加private : student stu[15];试试吧

------解决方案--------------------
在视图类中这段列表代码:
{
CKoma1993Doc *pDoc=GetDocument();

for(int i=0;i<15;i++)
{
ListCtrl.InsertItem(i, "");
ListCtrl.SetItemText(i,0, pDoc->stu[i].name);
ListCtrl.SetItemText(i,1, pDoc->stu[i].number);
ListCtrl.SetItemText(i,2, pDoc->stu[i].grades);
}

------解决方案--------------------
探讨
这下麻烦大了,view中的GetDocument有2个版本:
//Release版:
#ifndef _DEBUG // debug version in clist.cpp
inline CKoma1993Doc* Clist::GetDocument()
{ return (CKoma1993Doc* )m_pDocument; }
#endif
//调试版:
#ifdef ……