#pragma warning (disable : 4786)
2013-06-11 15:45
295 查看
参考一:
#pragma warning (disable : 4786)
( xp + VC6.0) 编译如下程序,初始化vector,在 容器中放入10个hello: #include stdafx.h #include vector using namespace std; int main(int argc, char* argv[]) { vectorstring vecStr(10, hello); return 0; } 编译后出现如下错误: warning C4786: s
( xp + VC6.0)
编译如下程序,初始化vector,在 容器中放入10个“hello”:
#include "stdafx.h"
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
vector<string> vecStr(10, "hello");
return 0;
}
编译后出现如下错误:
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> >,s
td::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
这是模板展开后名字太长引起的!!!
标识符字符串超出最大允许长度,因此被截断。
调试器无法调试符号超过 255 个字符长度的代码。无法在调试器中查看、计算、更新或监视被截断的符号。
缩短标识符名称可以解决此限制。
解决办法如下:
在#include "stdafx.h"下一行加入
#pragma warning (disable : 4786)
完整程序为:
#include "stdafx.h"
#pragma warning (disable : 4786)
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
vector<string> vecStr(10, "hello");
return 0;
}
参考二:
vc6用map库为什么会有很多warning?#include <iostream>
#include <vector>
#include <string>
#include <map>
void main()
{
using namespace std;
map<string,string> trans_map;
typedef map<string,string>::value_type valType;
trans_map.insert(valType("gratz","grateful"));
trans_map.insert(valType("'em","them"));
trans_map.insert(valType("cuz","cause"));
trans_map.insert(valType("nah","no"));
trans_map.insert(valType("sez","sees"));
//输出map
map<string,string>::iterator it;
cout<<"显示输出map:\n";
for(it=trans_map.begin();it!=trans_map.end();it++)
{
cout<<"key:"<<(*it).first<<"\t"
<<"value:"<<(*it).second<<endl;
}
cout<<endl;
}
#pragma warning(disable:4715)
#pragma warning(disable:4390)
#pragma warning(disable:4786)
vc6对stl的支持不好。
基本上都是报4786警告。
可以用#pragma warning(disable:4786)把警告去掉。
#pragma warning (disable : 4786)
( xp + VC6.0) 编译如下程序,初始化vector,在 容器中放入10个hello: #include stdafx.h #include vector using namespace std; int main(int argc, char* argv[]) { vectorstring vecStr(10, hello); return 0; } 编译后出现如下错误: warning C4786: s
( xp + VC6.0)
编译如下程序,初始化vector,在 容器中放入10个“hello”:
#include "stdafx.h"
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
vector<string> vecStr(10, "hello");
return 0;
}
编译后出现如下错误:
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> >,s
td::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
这是模板展开后名字太长引起的!!!
标识符字符串超出最大允许长度,因此被截断。
调试器无法调试符号超过 255 个字符长度的代码。无法在调试器中查看、计算、更新或监视被截断的符号。
缩短标识符名称可以解决此限制。
解决办法如下:
在#include "stdafx.h"下一行加入
#pragma warning (disable : 4786)
完整程序为:
#include "stdafx.h"
#pragma warning (disable : 4786)
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
vector<string> vecStr(10, "hello");
return 0;
}
参考二:
vc6用map库为什么会有很多warning?#include <iostream>
#include <vector>
#include <string>
#include <map>
void main()
{
using namespace std;
map<string,string> trans_map;
typedef map<string,string>::value_type valType;
trans_map.insert(valType("gratz","grateful"));
trans_map.insert(valType("'em","them"));
trans_map.insert(valType("cuz","cause"));
trans_map.insert(valType("nah","no"));
trans_map.insert(valType("sez","sees"));
//输出map
map<string,string>::iterator it;
cout<<"显示输出map:\n";
for(it=trans_map.begin();it!=trans_map.end();it++)
{
cout<<"key:"<<(*it).first<<"\t"
<<"value:"<<(*it).second<<endl;
}
cout<<endl;
}
#pragma warning(disable:4715)
#pragma warning(disable:4390)
#pragma warning(disable:4786)
vc6对stl的支持不好。
基本上都是报4786警告。
可以用#pragma warning(disable:4786)把警告去掉。
相关文章推荐
- #pragma warning(disable 4786)
- #pragma warning(disable:4786)
- #pragma warning (disable : 4786)
- 在VC下加入这条语句,屏蔽4786警告 #pragma warning (disable:4786)
- C++写#pragma warning(disable 4786)的作用
- #pragma warning(disable:4786)
- 关于#pragma comment(lib,"ws2_32.lib")和 #pragma warning(disable : 4786)
- 资料整理: #pragma warning(disable : 4786) 在vs6中失效的原因
- #pragma warning(disable:4996)
- #pragma warning(disable:4244)
- #pragma warning(disable 4786)
- #pragma warning (disable : xxxx)用法
- #pragma warning disable/restore 警告号码的查找,在输出中可以看到
- #pragma warning(disable 4786)
- C# #pragma warning disable/restore
- #pragma warning(disable:4996)
- #pragma warning(disable:4996)
- #pragma warning(disable:4996)
- #pragma warning(disable:xxxx)
- #pragma warning(disable:4699)