By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,463 Members | 2,954 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,463 IT Pros & Developers. It's quick & easy.

map and visual C++

P: n/a
#include<map>
#include<iostream>
#include<string>

using namespace std;

int main()
{

map <string,int> test;

test["hello"]=5;
test.insert(map<string,int>::value_type("bye",10)) ;

typedef map<string,int>::const_iterator CI;

for(CI p=test.begin();p!=test.end();++p)
cout<<p->first<<" "<<p->second<<endl;
return 0;
}

The above code gives around 100 warnings on compiling in Microsoft
Visual C++ compiler.Most of which don't make any sense to me.If any
one can throw some light on the warnings.I am also posting some sample
warnings.I have tried using vector container also but that doesn't
give any error.It's only when i use map that these warnings arise.
/****Warnings*****/
c:\program files\microsoft visual studio\vc98\include\xtree(120) :
warning C4786: 'std::_Tree<std::basic_string<char,std::char_trait s<char>,std::allocator<char>
,std::pair<std::basic_string<char,std::char_trait s<char>,std::allocator<char>
const , int>,std::map<std::basic_string<char,std::char_tra its<char>,std::allocator<char>,int,std::less<std::basic_string<char,std::char_t raits<char>,std::allocator<char>
,std::allocator<int>::_Kfn,std::less<std::basic_string<char,std::char _traits<cha

r>,std::allocator<char> > >,std::allocator<int> >' : identifier was
truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\map(46)
: see reference to class template instantiation
'std::_Tree<std::basic_string<char,std::char_trait s<char>,std::allocator<char>,std::pair<std::basic_string<char,std::char_trait s< char>,std::allocator<char> > const
,int>,std::map<std::basic_string<char,std::char_tr aits<char>,std::allocator<char>,int,std::less<std::basic_string<char,std::char_t raits<char>,std::allocator<char>
,std::allocator<int> >::_Kfn,std::less<std::ba
sic_string<char,std::char_traits<char>,std::alloca tor<char> >,std::allocator<int> >' being compiled C:\Documents and Settings\Somesh Chandra\Desktop\Assembler\New
Folder\Cpp1.cpp(11) : see reference to class template instantiation
'std::map<std::basic_string<char,std::char_traits< char>,std::allocator<char>,int,std::less<std::basic_string <char,std::char_traits<char>,std::allocator<char > >,std::allocator<int> >' being compiled c:\program files\microsoft visual studio\vc98\include\xtree(120) :
warning C4786: 'std::_Tree<std::basic_string<char,std::char_trait s<char>,std::allocator<char>,std::pair<std::basic_string<char,std::char_trait s<char>,std::allocator<char>
const , int>,std::map<std::basic_string<char,std::char_tra its<char>,std::allocator<char>,int,std::less<std::basic_string<char,std::char_t raits<char>,std::allocator<char>
,std::allocator<int>::_Kfn,std::less<std::basic_string<char,std::char _traits<cha

r>,std::allocator<char> > >,std::allocator<int> >::const_iterator' :
identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\map(46)
: see reference to class template instantiation
'std::_Tree<std::basic_string<char,std::char_trait s<char>,std::allocator<char>,std::pair<std::basic_string<char,std::char_trait s< char>,std::allocator<char> > const
,int>,std::map<std::basic_string<char,std::char_tr aits<char>,std::allocator<char>,int,std::less<std::basic_string<char,std::char_t raits<char>,std::allocator<char>
,std::allocator<int> >::_Kfn,std::less<std::ba
sic_string<char,std::char_traits<char>,std::alloca tor<char> >,std::allocator<int> >' being compiled C:\Documents and Settings\Somesh Chandra\Desktop\Assembler\New
Folder\Cpp1.cpp(11) : see reference to class template instantiation
'std::map<std::basic_string<char,std::char_traits< char>,std::allocator<char>,int,std::less<std::basic_string <char,std::char_traits<char>,std::allocator<char > >,std::allocator<int> >' being compiled c:\program files\microsoft visual studio\vc98\include\xtree(120) :
warning C4786: 'std::_Tree<std::basic_string<char,std::char_trait s<char>,std::allocator<char>,std::pair<std::basic_string<char,std::char_trait s<char>,std::allocator<char>
const , int>,std::map<std::basic_string<char,std::char_tra its<char>,std::allocator<char>,int,std::less<std::basic_string<char,std::char_t raits<char>,std::allocator<char>
,std::allocator<int>::_Kfn,std::less<std::basic_string<char,std::char _traits<cha

r>,std::allocator<char> > >,std::allocator<int> >::iterator' :
identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\map(46)
: see reference to class template instantiation
'std::_Tree<std::basic_string<char,std::char_trait s<char>,std::allocator<char>,std::pair<std::basic_string<char,std::char_trait s< char>,std::allocator<char> > const
,int>,std::map<std::basic_string<char,std::char_tr aits<char>,std::allocator<char>,int,std::less<std::basic_string<char,std::char_t raits<char>,std::allocator<char>
,std::allocator<int> >::_Kfn,std::less<std::ba
sic_string<char,std::char_traits<char>,std::alloca tor<char> >,std::allocator<int> >' being compiled C:\Documents and Settings\Somesh Chandra\Desktop\Assembler\New
Folder\Cpp1.cpp(11) : see reference to class template instantiation
'std::map<std::basic_string<char,std::char_traits< char>,std::allocator<char>,int,std::less<std::basic_string <char,std::char_traits<char>,std::allocator<char > >,std::allocator<int> >' being compiled c:\program files\microsoft visual studio\vc98\include\xtree(120) :
warning C4786: 'std::_Tree<std::basic_string<char,std::char_trait s<char>,std::allocator<char>,std::pair<std::basic_string<char,std::char_trait s<char>,std::allocator<char>
const , int>,std::map<std::basic_string<char,std::char_tra its<char>,std::allocator<char>,int,std::less<std::basic_string<char,std::char_t raits<char>,std::allocator<char>
,std::allocator<int>::_Kfn,std::less<std::basic_string<char,std::char _traits<cha

r>,std::allocator<char> > >,std::allocator<int> >::_Node' : identifier
was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\map(46)
: see reference to class template instantiation
'std::_Tree<std::basic_string<char,std::char_trait s<char>,std::allocator<char>,std::pair<std::basic_string<char,std::char_trait s< char>,std::allocator<char> > const
,int>,std::map<std::basic_string<char,std::char_tr aits<char>,std::allocator<char>,int,std::less<std::basic_string<char,std::char_t raits<char>,std::allocator<char>
,std::allocator<int> >::_Kfn,std::less<std::ba
sic_string<char,std::char_traits<char>,std::alloca tor<char> >,std::allocator<int> >' being compiled C:\Documents and Settings\Somesh Chandra\Desktop\Assembler\New
Folder\Cpp1.cpp(11) : see reference to class template instantiation
'std::map<std::basic_string<char,std::char_traits< char>,std::allocator<char>,int,std::less<std::basic_string <char,std::char_traits<char>,std::allocator<char > >,std::allocator<int> >' being compiled


/****Warnings continued*******/

Thanks
Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Somesh wrote:
#include<map>
#include<iostream>
#include<string>

using namespace std;

int main()
{

map <string,int> test;

test["hello"]=5;
test.insert(map<string,int>::value_type("bye",10)) ;

typedef map<string,int>::const_iterator CI;

for(CI p=test.begin();p!=test.end();++p)
cout<<p->first<<" "<<p->second<<endl;
return 0;
}

The above code gives around 100 warnings on compiling in Microsoft
Visual C++ compiler.Most of which don't make any sense to me.If any
one can throw some light on the warnings.[...]


Please ask compiler-specific questions in a newsgroup dedicated to that
compiler (in this case, microsoft.public.vc.language).

Warnings can be disabled. Warnings can be ignored. But one thing is
for sure, they are not part of the language.

V
Jul 23 '05 #2

P: n/a
ch************@gmail.com (Somesh) wrote in
news:40**************************@posting.google.c om:
#include<map>
#include<iostream>
#include<string>

using namespace std;

int main()
{

map <string,int> test;

test["hello"]=5;
test.insert(map<string,int>::value_type("bye",10)) ;

typedef map<string,int>::const_iterator CI;

for(CI p=test.begin();p!=test.end();++p)
cout<<p->first<<" "<<p->second<<endl;
return 0;
}

The above code gives around 100 warnings on compiling in Microsoft
Visual C++ compiler.Most of which don't make any sense to me.If any
one can throw some light on the warnings.I am also posting some sample
warnings.I have tried using vector container also but that doesn't
give any error.It's only when i use map that these warnings arise.
/****Warnings*****/
[snip]
/****Warnings continued*******/

Thanks


This has nothing to do with Standard C++, but is a Microsoft-specific
question. Go ask in a Microsoft-specific newsgroup.

Personally, I'd just disable the C4786 warning.

Jul 23 '05 #3

P: n/a
> The above code gives around 100 warnings on compiling in Microsoft
Visual C++ compiler.Most of which don't make any sense to me.If any


I got the same problem the first time I tried to use std::map too. I
have never been able to find a clean solution. It seems these warnings
are produced because VC6.0 internal class names are limited to 255
characters, but class names tend to be very long when using STL.
Solution:
either disable the warning with #pragma, it works,
either use another compiler. VC6.0 is really crappy when dealing with
templates. I recommend you to upgrade your compiler to VC7.1 which has a
far better support for templates and standard C++ in general.
-Fred
Jul 23 '05 #4

P: n/a
USE DEV C++ : OPEN SOURCE IS THE BEST

Jul 23 '05 #5

P: n/a
Somesh wrote:
#include<map>
#include<iostream>
#include<string>

using namespace std;

int main()
{

map <string,int> test;

test["hello"]=5;
test.insert(map<string,int>::value_type("bye",10)) ;

typedef map<string,int>::const_iterator CI;

for(CI p=test.begin();p!=test.end();++p)
cout<<p->first<<" "<<p->second<<endl;
return 0;
}

The above code gives around 100 warnings on compiling in Microsoft
Visual C++ compiler.Most of which don't make any sense to me.If any
one can throw some light on the warnings.I am also posting some sample
warnings.I have tried using vector container also but that doesn't
give any error.It's only when i use map that these warnings arise.
/****Warnings*****/ [snip] /****Warnings continued*******/

Thanks


Try microsoft.public.vstudio.general.

[OT] Or 1) compile in release mode, 2) type #pragma
warning(disable:4786) ..Visual Studio makes a file for debugging
purposes when you compile in debug mode that helps a debugger name
functions, variables, and objects correctly, and it only saves 255
characters, which is why you see some of those warnings[/OT]
Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.