C++ map 不能用

来源:百度知道 编辑:UC知道 时间:2024/05/25 11:34:23
是类用不了!

简单函数如:
#include "stdafx.h"
#include <map>
#include <string>
#include <iostream>
using namespace std;

int main(int argc, char* argv[])
{
map<int,int> m_map;
return 0;
}

出现好多的warning!
-------------------Configuration: Map - Win32 Debug--------------------
Compiling...
Map.cpp
D:\VC++6.0学习\Map\Map.cpp(16) : warning C4786: 'std::reverse_bidirectional_iterator<std::_Tree<int,std::pair<int const ,int>,std::map<int,int,std::less<int>,std::allocator<int> >::_Kfn,std::less<int>,std::allocator<int> >::iterator,std::pair<int co
nst ,int>,std::pair<int const ,int> &,std::pair<int const ,int> *,int>' : identifier was truncated to '255' characters in the debug information
D:\VC++6.0学习\Map\Map.cpp(16) : warning C4786: 'std::reverse_bidirectiona

这不是已经编译通过了么

这些警告的意思是,某些标识符太长了,超过255个字符, 在debug显示的时候会被截断。 这个警告没办法解决的, 所以就不要在意了。 或者你可以在前面加一句:
#pragma warning(disable:4786)
这样可以关掉这个warning(当然这只是让他不显示而已)

最好换成 vs 2005或者 2008.新的编译器对模板类的支持要好很多

不是你却了什么东西,而是你不应该选vc6来学习c++。vc2008,g++,c++ builder都是不错的软件。

在做这些程序的时候,不用管警告内容,它不会影响程序的运行!出现警告信息,可能是你的软件没有装全哈!!!

严重建议使用vc2008或者gcc
还有警告完全不用理会