map and visual C++

S

Somesh

#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 said:
,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
const ,
::_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 said:
,std::pair<std::basic_string<char,std::char_traits<
sic_string said:
,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 said:
,int,std::less<std::basic_string
,std::allocator<int> >' being compiled
c:\program files\microsoft visual studio\vc98\include\xtree(120) :
warning C4786: 'std::_Tree said:
,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
const ,
::_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 said:
,std::pair<std::basic_string<char,std::char_traits<
sic_string said:
,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 said:
,int,std::less<std::basic_string
,std::allocator<int> >' being compiled
c:\program files\microsoft visual studio\vc98\include\xtree(120) :
warning C4786: 'std::_Tree said:
,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
const ,
::_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 said:
,std::pair<std::basic_string<char,std::char_traits<
sic_string said:
,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 said:
,int,std::less<std::basic_string
,std::allocator<int> >' being compiled
c:\program files\microsoft visual studio\vc98\include\xtree(120) :
warning C4786: 'std::_Tree said:
,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
const ,
::_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 said:
,std::pair<std::basic_string<char,std::char_traits<
sic_string said:
,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 said:
,int,std::less<std::basic_string
,std::allocator<int> >' being compiled

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

Thanks
 
A

Andre Kostur

(e-mail address removed) (Somesh) wrote in
#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.
 
V

Victor Bazarov

Somesh said:
#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
 
F

Fred

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
 
K

Ken Human

Somesh said:
#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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top