⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_55137.htm

📁 vc
💻 HTM
字号:
<p>
序号:55137 发表者:鹏程 发表日期:2003-10-07 00:46:00
<br>主题:请教关于MFC集合类
<br>内容:请问要使用CStringLidt链表对象,需要包含什么头文件?<BR><BR><BR><BR><BR><BR><BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:tjhe 回复日期:2003-10-07 09:32:13
<br>内容:CStringList&nbsp;&nbsp;//Afxcoll.h<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:鹏程 回复日期:2003-10-07 10:42:21
<br>内容:谢谢。但是包含了Afxcoll.h也不行,为什么?<BR><BR><BR><BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:jackyxio 回复日期:2003-10-07 10:57:58
<br>内容:鹏程,麻烦把问题说清楚!!<BR><BR>一般来说,包含了头文件就应该可以了。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:鹏程 回复日期:2003-10-07 11:17:00
<br>内容:谢谢!<BR>我在CEditorDoc类中使用了CStringLidt对象:<BR><BR>// editorDoc.h : interface of the CEditorDoc class<BR>//<BR>/////////////////////////////////////////////////////////////////////////////<BR><BR>#if !defined(AFX_EDITORDOC_H__AB9531E2_8D26_42E6_898F_F0DB4D77AE58__INCLUDED_)<BR>#define AFX_EDITORDOC_H__AB9531E2_8D26_42E6_898F_F0DB4D77AE58__INCLUDED_<BR><BR>#if _MSC_VER &gt; 1000<BR>#pragma once<BR>#endif // _MSC_VER &gt; 1000<BR><BR>////////////////////////////////////////////////<BR>#include &#34;AFXCOLL.h&#34;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//包含文件<BR><BR><BR><BR><BR>class CEditorDoc : public CDocument<BR>{<BR>protected: // create from serialization only<BR>&nbsp;&nbsp;&nbsp;&nbsp;CEditorDoc();<BR>&nbsp;&nbsp;&nbsp;&nbsp;DECLARE_DYNCREATE(CEditorDoc)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>// Attributes<BR>public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;CStringLidt lines;&nbsp;&nbsp;//定义数据成员<BR>&nbsp;&nbsp;&nbsp;&nbsp;int nLineNum;<BR><BR>// Operations<BR>public:<BR><BR>// Overrides<BR>&nbsp;&nbsp;&nbsp;&nbsp;// ClassWizard generated virtual function overrides<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_VIRTUAL(CEditorDoc)<BR>&nbsp;&nbsp;&nbsp;&nbsp;public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual BOOL OnNewDocument();<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual void Serialize(CArchive&amp; ar);<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_VIRTUAL<BR><BR>// Implementation<BR>public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual ~CEditorDoc();<BR>#ifdef _DEBUG<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual void AssertValid() const;<BR>&nbsp;&nbsp;&nbsp;&nbsp;virtual void Dump(CDumpContext&amp; dc) const;<BR>#endif<BR><BR>protected:<BR><BR>// Generated message map functions<BR>protected:<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_MSG(CEditorDoc)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// NOTE - the ClassWizard will add and remove member functions here.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;DO NOT EDIT what you see in these blocks of generated code !<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_MSG<BR>&nbsp;&nbsp;&nbsp;&nbsp;DECLARE_MESSAGE_MAP()<BR>};<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR><BR>//{{AFX_INSERT_LOCATION}}<BR>// Microsoft Visual C++ will insert additional declarations immediately before the previous line.<BR><BR>#endif // !defined(AFX_EDITORDOC_H__AB9531E2_8D26_42E6_898F_F0DB4D77AE58__INCLUDED_)<BR><BR>然后初始化变量:<BR><BR>BOOL CEditorDoc::OnNewDocument()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (!CDocument::OnNewDocument())<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return FALSE;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: add reinitialization code here<BR>&nbsp;&nbsp;&nbsp;&nbsp;// (SDI documents will reuse this document)<BR>&nbsp;&nbsp;&nbsp;&nbsp;nLineNum=0;&nbsp;&nbsp; //数据成员初始化<BR>&nbsp;&nbsp;&nbsp;&nbsp;POSITION pos;<BR>&nbsp;&nbsp;&nbsp;&nbsp;pos=lines.GetHeadPosition();<BR>&nbsp;&nbsp;&nbsp;&nbsp;while(pos!=NULL)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CString)lines.GetNext(pos)).Empty();<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;lines.RemoveAll();<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;return TRUE;<BR>}<BR><BR>结果出现编译信息如下:<BR><BR>--------------------Configuration: editor - Win32 Debug--------------------<BR>Compiling resources...<BR>Compiling...<BR>StdAfx.cpp<BR>Compiling...<BR>editor.cpp<BR>e:\vc_mfc\editor\editordoc.h(26) : error C2146: syntax error : missing ';' before identifier 'lines'<BR>e:\vc_mfc\editor\editordoc.h(26) : error C2501: 'CStringLidt' : missing storage-class or type specifiers<BR>e:\vc_mfc\editor\editordoc.h(26) : error C2501: 'lines' : missing storage-class or type specifiers<BR>editorDoc.cpp<BR>e:\vc_mfc\editor\editordoc.h(26) : error C2146: syntax error : missing ';' before identifier 'lines'<BR>e:\vc_mfc\editor\editordoc.h(26) : error C2501: 'CStringLidt' : missing storage-class or type specifiers<BR>e:\vc_mfc\editor\editordoc.h(26) : error C2501: 'lines' : missing storage-class or type specifiers<BR>E:\vc_MFC\editor\editorDoc.cpp(49) : error C2065: 'lines' : undeclared identifier<BR>E:\vc_MFC\editor\editorDoc.cpp(49) : error C2228: left of '.GetHeadPosition' must have class/struct/union type<BR>E:\vc_MFC\editor\editorDoc.cpp(52) : error C2228: left of '.GetNext' must have class/struct/union type<BR>E:\vc_MFC\editor\editorDoc.cpp(52) : error C2228: left of '.Empty' must have class/struct/union type<BR>E:\vc_MFC\editor\editorDoc.cpp(54) : error C2228: left of '.RemoveAll' must have class/struct/union type<BR>editorView.cpp<BR>e:\vc_mfc\editor\editordoc.h(26) : error C2146: syntax error : missing ';' before identifier 'lines'<BR>e:\vc_mfc\editor\editordoc.h(26) : error C2501: 'CStringLidt' : missing storage-class or type specifiers<BR>e:\vc_mfc\editor\editordoc.h(26) : error C2501: 'lines' : missing storage-class or type specifiers<BR>MainFrm.cpp<BR>Generating Code...<BR>Error executing cl.exe.<BR>Creating browse info file...<BR><BR>editor.exe - 14 error(s), 0 warning(s)<BR><BR>为什么包含了文件#include &#34;AFXCOLL.h&#34;也不行呢???<BR><BR><BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:tjhe 回复日期:2003-10-07 11:50:04
<br>内容:是CStringList还是CStringLidt?
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:鹏程 回复日期:2003-10-07 12:02:51
<br>内容:谢谢了,是我写错了,没看出来。<BR><BR><BR><BR><BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -