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

📄 subject_26605.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:26605 发表者:brown 发表日期:2003-01-03 07:43:48
<br>主题:當 VC++ 遇到 iterator
<br>内容:各位前輩,我的原碼如下,在 C++ builder 編譯沒問題,但在 VC++<BR>卻有 error,請問有哪些前輩知道為什麼嗎?<BR><BR>#include "stdafx.h"<BR>#include &lt;string&gt;<BR>#include &lt;vector&gt;<BR>#include &lt;iterator&gt;<BR>using std::string;<BR>using std::vector;<BR>vector&lt;string&gt;::iterator a;&nbsp;&nbsp; // 有 error<BR>int main(int argc, char* argv[])<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;return 0;<BR>}<BR><BR><BR><BR>error C2653: 'vector&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;,class std::allocator&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;cha<BR>r&gt; &gt; &gt; &gt;' : is not a class or namespace name<BR><BR>還有位什麼 MSDN 內沒有 error C2653 的解釋? 有 C2652,C2654 就是跳掉 C2653,<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>
<font color=red>答案被接受</font><br>回复者:bb 回复日期:2003-01-03 16:50:05
<br>内容:using std::string;<BR>using std::vector;<BR>应为:<BR>using namespace std;
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:brown 回复日期:2003-01-05 11:09:03
<br>内容:您的方法可成功,沒有 error,但還有 warning. (我的設定:Build-&gt;Set Active Configuration -&gt;Debug)<BR>請問要如何消除這些 warning?<BR>c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: 'std::reverse_iterator&lt;std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; const *,std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt;<BR> &gt;,std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; const &amp;,std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; const *,int&gt;' : identifier was truncated to '255' characters in the debug information<BR>c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: 'std::reverse_iterator&lt;std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; *,std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt;,std<BR>::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; &amp;,std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; *,int&gt;' : identifier was truncated to '255' characters in the debug information<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-01-05 16:40:36
<br>内容:好像加這個,你試看看...<BR><BR>#ifdef&nbsp;&nbsp;&nbsp;&nbsp;_MSC_VER<BR>#pragma warning(disable: 4201)<BR>#pragma warning(disable: 4100)<BR>#pragma warning(disable: 4786)<BR>#endif<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>
回复者:brown 回复日期:2003-01-06 08:48:38
<br>内容:章民,<BR>&nbsp;&nbsp;謝謝,是沒 warning 出現了。<BR>但是這個方法似乎只是讓 warning 不顯示出來,<BR>有沒有別的方法讓 warning 真的不存在?(雖然說<BR>這些 warning 看起來並不是很重要)<BR><BR>brown.
<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 + -