晕,一个简简单单的C++程序,编译那么多警告错误??? |
程序: #include <iostream> #include <fstream> #include <string> #include <map> #pragma warning (disable : 4786) #pragma warning (disable : 4086) using namespace std; int main(char *argv[], int argc) { ifstream isfile("source.txt"); if(!isfile) { cerr << "can't open file !" << endl; return -1; } char sALine[1024]; map< int , string> ip; ip.insert(std::make_pair(3,string("3"))); map< string , string > LineMap; while(isfile.getline(sALine, 1024)) { cout << sALine << endl; LineMap.insert(std::make_pair(string("abcd"), string("ef"))); } return 0; } 警告列表: V12@@2@U_Kfn@?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@U?$less@V? $basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@IAEXPAU_Node@12@@Z' : identifier was truncated to '255' characters in the debug information c:\program files\microsoft visual studio\vc98\include\xtree(574) : warning C4786: '__unwindfunclet$?_Rrotate@?$_Tree@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@s td@@V12@@2@U_Kfn@?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@U?$les s@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@IAEXPAU_Node@12@@Z$0' : identifier was truncated to '255' characters in the debug information c:\program files\microsoft visual studio\vc98\include\xtree(574) : warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const , std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<cha r,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basi c_string<char,std::char_traits<char>,std::allocator<char> > > >::_Rrotate' : identifier was truncated to '255' characters in the debug information c:\program files\microsoft visual studio\vc98\include\xtree(590) : warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const , std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<cha r,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basi c_string<char,std::char_traits<char>,std::allocator<char> > > >::_Buynode' : identifier was truncated to '255' characters in the debug information c:\program files\microsoft visual studio\vc98\include\xtree(592) : warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const , std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<cha r,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basi c_string<char,std::char_traits<char>,std::allocator<char> > > >::_Consval' : identifier was truncated to '255' characters in the debug information c:\program files\microsoft visual studio\vc98\include\xtree(594) : warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const , std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<cha r,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basi c_string<char,std::char_traits<char>,std::allocator<char> > > >::_Destval' : identifier was truncated to '255' characters in the debug information c:\program files\microsoft visual studio\vc98\include\xtree(65) : warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,s td::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char ,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic _string<char,std::char_traits<char>,std::allocator<char> > > >::const_iterator::const_iterator' : identifier was truncated to '255' characters in the debug information c:\program files\microsoft visual studio\vc98\include\xtree(102) : warning C4786: '__ehhandler$?_Dec@const_iterator@?$_Tree@V?$basic_string@DU?$char_traits@D@std@@V? SortStr.exe - 0 error(s), 163 warning(s) |
Yuna_2z(别总是和我谈论XX是高手-告你我不是) 于 2005-5-12 17:00:01 |
在VC下~我也遇到过这种情况~~在代码无错的情况下~~能运行~~你试试 |
Seu_why(小银子) 于 2005-5-12 17:16:59 |
vc6 一大堆警告,vs2003 风平浪静. 为什么呢? 关注! |
whyglinux(山青水秀) 于 2005-5-12 17:18:24 |
把 #pragma warning (disable : 4786) #pragma warning (disable : 4086) 放到文件的开始处。 |
djfu(一马平川) 于 2005-5-12 17:18:38 |
很多人说是因为 VC6 与标准不兼容? |
xyz_mw(abc) 于 2005-5-12 17:20:39 |
vc6的问题 |
Seu_why(小银子) 于 2005-5-12 17:24:12 |
#pragma warning (disable : 4786) #pragma warning (disable : 4086) 放到文件的开始处 ______________________________________ 可以了,为什么? |
djfu(一马平川) 于 2005-5-12 17:24:38 |
whyglinux(山青水秀) 你的方法不错,果然可以消除了。 |
BugYou004 于 2005-5-12 17:29:35 |
嘿嘿!! 长见识啦 |
ericqxg007(一笑而过) 于 2005-5-12 19:07:42 |
我想知道这是为什么? |
guyaguya(我只愿面朝大海,春暖花开) 于 2005-5-12 20:16:28 |
搜下 pragma的用法就知道为什么了 |