📄 subject_26605.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 <string><BR>#include <vector><BR>#include <iterator><BR>using std::string;<BR>using std::vector;<BR>vector<string>::iterator a; // 有 error<BR>int main(int argc, char* argv[])<BR>{<BR> return 0;<BR>}<BR><BR><BR><BR>error C2653: 'vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<cha<BR>r> > > >' : 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->Set Active Configuration ->Debug)<BR>請問要如何消除這些 warning?<BR>c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,std::basic_string<char,std::char_traits<char>,std::allocator<char><BR> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,int>' : 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<std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std<BR>::basic_string<char,std::char_traits<char>,std::allocator<char> > &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,int>' : 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 _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> 謝謝,是沒 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 + -