📄 subject_21787.htm
字号:
<p>
序号:21787 发表者:yingpf 发表日期:2002-11-20 13:58:19
<br>主题:怎么会???
<br>内容:#include "student.h"<BR><BR>class CUrlCollectDoc : public CDocument<BR>{<BR>protected: // create from serialization only<BR> CUrlCollectDoc();<BR> DECLARE_DYNCREATE(CUrlCollectDoc)<BR><BR>// Attributes<BR> CTypedPtrList<CObList, Student*> m_stuList; //Error!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<BR>// Operations<BR>public:<BR><BR>// Overrides<BR> // ClassWizard generated virtual function overrides<BR> //{{AFX_VIRTUAL(CUrlCollectDoc)<BR> public:<BR> virtual BOOL OnNewDocument();<BR> virtual void Serialize(CArchive& ar);<BR> //}}AFX_VIRTUAL<BR><BR>// Implementation<BR>public:<BR> virtual ~CUrlCollectDoc();<BR>#ifdef _DEBUG<BR> virtual void AssertValid() const;<BR> virtual void Dump(CDumpContext& dc) const;<BR>#endif<BR><BR>protected:<BR><BR>// Generated message map functions<BR>protected:<BR> //{{AFX_MSG(CUrlCollectDoc)<BR> // NOTE - the ClassWizard will add and remove member functions here.<BR> // DO NOT EDIT what you see in these blocks of generated code !<BR> //}}AFX_MSG<BR> DECLARE_MESSAGE_MAP()<BR>};<BR><BR>以上程序中的CTypedPtrList<CObList, Student*> m_stuList;出现如下错(Student类已声明了) :<BR>e:\vc\urlcollect\urlcollectdoc.h(21) : error C2143: syntax error : missing ';' before '<'<BR>e:\vc\urlcollect\urlcollectdoc.h(21) : error C2501: 'CTypedPtrList' : missing storage-class or type specifiers<BR>e:\vc\urlcollect\urlcollectdoc.h(21) : error C2059: syntax error : '<'<BR>e:\vc\urlcollect\urlcollectdoc.h(21) : error C2238: unexpected token(s) preceding ';'<BR>UrlCollectDoc.cpp<BR>e:\vc\urlcollect\urlcollectdoc.h(21) : error C2143: syntax error : missing ';' before '<'<BR>e:\vc\urlcollect\urlcollectdoc.h(21) : error C2501: 'CTypedPtrList' : missing storage-class or type specifiers<BR>e:\vc\urlcollect\urlcollectdoc.h(21) : error C2059: syntax error : '<'<BR>e:\vc\urlcollect\urlcollectdoc.h(21) : error C2238: unexpected token(s) preceding ';'<BR>E:\Vc\UrlCollect\UrlCollectDoc.cpp(66) : error C2065: 'm_stuList' : undeclared identifier<BR>E:\Vc\UrlCollect\UrlCollectDoc.cpp(66) : error C2228: left of '.Serialize' must have class/struct/union type<BR>UrlCollectView.cpp<BR>e:\vc\urlcollect\urlcollectdoc.h(21) : error C2143: syntax error : missing ';' before '<'<BR>e:\vc\urlcollect\urlcollectdoc.h(21) : error C2501: 'CTypedPtrList' : missing storage-class or type specifiers<BR>e:\vc\urlcollect\urlcollectdoc.h(21) : error C2059: syntax error : '<'<BR>e:\vc\urlcollect\urlcollectdoc.h(21) : error C2238: unexpected token(s) preceding ';'<BR>Generating Code...
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:CDMA2000 回复日期:2002-11-20 14:07:29
<br>内容:缺少模板类的头文件<BR>#include <afxtempl.h><BR><BR><BR>2002-11-20 14:09:20
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -