解决VC中的有关STl 的4786编译警告
来源:互联网 发布:分治算法几个经典例子 编辑:程序博客网 时间:2024/04/27 18:15
--------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
D:/1prg/Microsoft Visual Studio/prg/menu/Cpp1.cpp(13) : 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>; >;,std::basi
c_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
D:/1prg/Microsoft Visual Studio/prg/menu/Cpp1.cpp(13) : 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::basic_stri
ng<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
d:/1prg/microsoft visual studio/common/vc98/include/vector(47) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>;,std::allocator<char>; >;,std::allocator<std::basic_string<char,std::char_traits<char>;,std::allocator<char>; >; >; >;
::vector<std::basic_string<char,std::char_traits<char>;,std::allocator<char>; >;,std::allocator<std::basic_string<char,std::char_traits<char>;,std::allocator<char>; >; >; >;' : identifier was truncated to '255' characters in the debug information
d:/1prg/microsoft visual studio/common/vc98/include/vector(60) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>;,std::allocator<char>; >;,std::allocator<std::basic_string<char,std::char_traits<char>;,std::allocator<char>; >; >; >;
::~vector<std::basic_string<char,std::char_traits<char>;,std::allocator<char>; >;,std::allocator<std::basic_string<char,std::char_traits<char>;,std::allocator<char>; >; >; >;' : identifier was truncated to '255' characters in the debug information
Linking...
Cpp1.exe - 0 error(s), 4 warning(s)
在VC 6.0 上使用 STL 的时候会出现这种警告。是由于C++在内部生成的变量名超过了 255 个字符所致,在测试(Debug)版本中编译器限制生成的变量名的最大长度。一般可以忽略这类错误,想屏蔽它可以使用 #pragma warning (disable: 4786)。
你其实不用理会这个警告,因为它只会影响到Debugger,而不会影响到真实的代码。实际上,如果你编译一个Release版本的话,就会发现这个警告已经完全消失了。
消除这个警告可能有一点难度,因为这属于预处理器的行为。
一般建议你这么做:
#pragma warning(disable : 4786)
#include <string>
#include <vector>
注意这个pragma声明一定要放在stl头文件之前!否则不起作用!
这个pragma也不是总能够发生效力的!有时候,并不能消除所有的这种C4786警告。
详情参见:
http://support.microsoft.com/support/kb/articles/Q167/3/55.ASP
微软声称,将在Microsoft Visual C++ .NET中解决这个问题。
- 解决VC中的有关STl 的4786编译警告
- 【VC编译问题】如何解决VC中的警告Warning C4251
- VC中使用STL出现的警告.
- 如何解决VC中的警告Warning C4251
- 如何解决VC中的警告Warning C4251
- 如何解决VC中的警告Warning C4251
- 避免VC报很多关于stl的警告
- VC++ 如何隐藏使用STL而带来的大量警告
- 如何解决"MSVCRED" conflicts的编译警告?
- 编译 FSharp 警告 FS0082 的解决
- 如何解决VC中的警告Warning C4251--- 转载
- 有关STL中的set容器的用法
- 解决编译过程中的strcpy/malloc/strlen incompatible警告
- wince下使用STL出现4786编译警告
- 谈VC中的有关文件的操作
- 【已解决】Android Studio编译OsmAnd出现警告:GeoPointParserUtil.java使用或覆盖了已过时的 API。有关详细信息请使用-Xlint:deprecation重新编
- Xlint deprecation编译警告解决
- warning LNK4098: defaultlib...的编译警告是怎么回事,怎样才解决?
- Q&Q_how_to_invoke_python_in_c
- 第二次去深圳——面试
- Symbian OS应用编程图形篇之动画(2)
- drawing雷库
- 2009年1月3日 星期六 開始
- 解决VC中的有关STl 的4786编译警告
- 3G
- 如何在ListBox中选择背景位图
- 2009年的第一场博客
- 我的linux阅读历程
- KXML2解析xml出现的问题及解决办法
- LINUX下批量修改文件名
- DataGridView绑定数据源
- [LINUX]查看系统版本信息的命令