首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

为啥vc 6.0 使用#include <地图>时候编译不了

2012-09-27 
为啥vc 6.0 使用#include map时候编译不了?#include map//#pragma warning (disable:4786) )//加入这

为啥vc 6.0 使用#include <map>时候编译不了?
#include <map>
//#pragma warning (disable:4786) )//加入这个也不行,不加也不行
#include <string>
#include <iostream>
using namespace std;

int main()

{

map<int, string> mapstudent;

mapstudent.insert(pair<int, string>(1, “student_one”));

mapstudent.insert(pair<int, string>(2, “student_two”));

mapstudent.insert(pair<int, string>(3, “student_three”));

map<int, string>::iterator iter;

for(iter = mapstudent.begin(); iter != mapstudent.end(); iter++)

{

Cout<<iter->first<<” ”<<iter->second<<end;

}

}
错误提示::\program files\microsoft visual studio\vc98\include\xtree(118) : warning C4786: 'std::_Tree<int,std::pair<int const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<int,std::basic_string<char,std::char_traits<char>,
std::allocator<char> >,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier 
was truncated to '255' characters in the debug information
  e:\program files\microsoft visual studio\vc98\include\map(46) : see reference to class template instantiation 'std::_Tree<int,std::pair<int const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<int,std::basic
_string<char,std::char_traits<char>,std::allocator<char> >,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::
allocator<char> > > >' being compiled
  E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(45) : see reference to class template instantiation 'std::map<int,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<int>,std::allocator<std::basic_s
tring<char,std::char_traits<char>,std::allocator<char> > > >' being compiled
e:\program files\microsoft visual studio\vc98\include\xtree(118) : warning C4786: 'std::_Tree<int,std::pair<int const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<int,std::basic_string<char,std::char_traits<char>,
std::allocator<char> >,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::const_iterato
r' : identifier was truncated to '255' characters in the debug information
  e:\program files\microsoft visual studio\vc98\include\map(46) : see reference to class template instantiation 'std::_Tree<int,std::pair<int const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<int,std::basic
_string<char,std::char_traits<char>,std::allocator<char> >,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::
allocator<char> > > >' being compiled
  E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(45) : see reference to class template instantiation 'std::map<int,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<int>,std::allocator<std::basic_s


tring<char,std::char_traits<char>,std::allocator<char> > > >' being compiled
e:\program files\microsoft visual studio\vc98\include\xtree(118) : warning C4786: 'std::_Tree<int,std::pair<int const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<int,std::basic_string<char,std::char_traits<char>,
std::allocator<char> >,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::iterator' : i
dentifier was truncated to '255' characters in the debug information
  e:\program files\microsoft visual studio\vc98\include\map(46) : see reference to class template instantiation 'std::_Tree<int,std::pair<int const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<int,std::basic
_string<char,std::char_traits<char>,std::allocator<char> >,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::
allocator<char> > > >' being compiled
  E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(45) : see reference to class template instantiation 'std::map<int,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<int>,std::allocator<std::basic_s
tring<char,std::char_traits<char>,std::allocator<char> > > >' being compiled
e:\program files\microsoft visual studio\vc98\include\xtree(118) : warning C4786: 'std::_Tree<int,std::pair<int const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<int,std::basic_string<char,std::char_traits<char>,
std::allocator<char> >,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Node' : iden
tifier was truncated to '255' characters in the debug information
  e:\program files\microsoft visual studio\vc98\include\map(46) : see reference to class template instantiation 'std::_Tree<int,std::pair<int const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<int,std::basic
_string<char,std::char_traits<char>,std::allocator<char> >,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::
allocator<char> > > >' being compiled
  E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(45) : see reference to class template instantiation 'std::map<int,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<int>,std::allocator<std::basic_s
tring<char,std::char_traits<char>,std::allocator<char> > > >' being compiled
e:\program files\microsoft visual studio\vc98\include\xtree(118) : warning C4786: 'std::_Tree<int,std::pair<int const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<int,std::basic_string<char,std::char_traits<char>,
std::allocator<char> >,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::const_iterato


r' : identifier was truncated to '255' characters in the debug information
  e:\program files\microsoft visual studio\vc98\include\map(46) : see reference to class template instantiation 'std::_Tree<int,std::pair<int const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<int,std::basic
_string<char,std::char_traits<char>,std::allocator<char> >,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<int>,std::allocator<std::basic_string<char,std::char_traits<char>,std::
allocator<char> > > >' being compiled
  E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(45) : see reference to class template instantiation 'std::map<int,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<int>,std::allocator<std::basic_s
tring<char,std::char_traits<char>,std::allocator<char> > > >' being compiled
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(47) : error C2018: unknown character '0xa1'
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(47) : error C2018: unknown character '0xb0'
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(47) : error C2018: unknown character '0xa1'
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(47) : error C2018: unknown character '0xb1'
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(47) : error C2065: 'student_one' : undeclared identifier
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(49) : error C2018: unknown character '0xa1'
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(49) : error C2018: unknown character '0xb0'
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(49) : error C2018: unknown character '0xa1'
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(49) : error C2018: unknown character '0xb1'
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(49) : error C2065: 'student_two' : undeclared identifier
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(51) : error C2018: unknown character '0xa1'
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(51) : error C2018: unknown character '0xb0'
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(51) : error C2018: unknown character '0xa1'
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(51) : error C2018: unknown character '0xb1'
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(51) : error C2065: 'student_three' : undeclared identifier
E:\Program Files\Microsoft Visual Studio\myProjects\map\map.cpp(53) : warning C4786: 
执行 cl.exe 时出错.

map.obj - 1 error(s), 0 warning(s)



[解决办法]
vc6 对模板支持不好。换高级版本吧

热点排行