Compile warning

When I #include <map> to use a function that needs map<> I get following warning message during compilation.
These are kind of harmless message as I can compile. link and run my program.
But I want to eliminate these messages.
What should I do?



D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\utility(17) : warning C4786: '?$pair@Viterator@?$_Tree@HU?$pair@$$CBHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@U_Kfn@?$map@HV?$basic_string@DU?$char_traits@D@std@@V?$all
ocator@D@2@@std@@U?$less@H@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@U?$less@H@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@_N' : identifier was truncated to '255' cha
racters in the browser information
        D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<int,struct std::pair<int const ,class std::basic_string<char,struct std::char_traits<char>,class std::a
llocator<char> > >,struct std::map<int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<int>,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator
<char> > > >::_Kfn,struct std::less<int>,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::iterator,bool>' being compiled
        D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\map(93) : while compiling class-template member function 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &__thiscall std::map<int,class std::basic
_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<int>,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::operator [](const int &)'
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\utility(21) : warning C4786: '??0?$pair@Viterator@?$_Tree@HU?$pair@$$CBHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@U_Kfn@?$map@HV?$basic_string@DU?$char_traits@D@std@@V?$
allocator@D@2@@std@@U?$less@H@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@U?$less@H@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@_N@std@@QAE@XZ' : identifier was truncat
ed to '255' characters in the browser information
        D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<int,struct std::pair<int const ,class std::basic_string<char,struct std::char_traits<char>,class std::a
llocator<char> > >,struct std::map<int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<int>,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator
<char> > > >::_Kfn,struct std::less<int>,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::iterator,bool>' being compiled
        D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\map(93) : while compiling class-template member function 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &__thiscall std::map<int,class std::basic
_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<int>,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::operator [](const int &)'
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\utility(23) : warning C4786: '??0?$pair@Viterator@?$_Tree@HU?$pair@$$CBHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@U_Kfn@?$map@HV?$basic_string@DU?$char_traits@D@std@@V?$
allocator@D@2@@std@@U?$less@H@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@U?$less@H@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@_N@std@@QAE@ABViterator@?$_Tree@HU?$pair
@$$CBHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@U_Kfn@?$map@HV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$less@H@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@U?$less
@H@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@1@AB_N@Z' : identifier was truncated to '255' characters in the browser information
        D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<int,struct std::pair<int const ,class std::basic_string<char,struct std::char_traits<char>,class std::a
llocator<char> > >,struct std::map<int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<int>,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator
<char> > > >::_Kfn,struct std::less<int>,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::iterator,bool>' being compiled
        D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\map(93) : while compiling class-template member function 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &__thiscall std::map<int,class std::basic
_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<int>,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::operator [](const int &)'
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\utility(25) : warning C4786: '??0?$pair@Viterator@?$_Tree@HU?$pair@$$CBHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@U_Kfn@?$map@HV?$basic_string@DU?$char_traits@D@std@@V?$
allocator@D@2@@std@@U?$less@H@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@U?$less@H@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@_N@std@@QAE@ABU?$pair@$DCAB@$DCAC@@1@@Z'
 : identifier was truncated to '255' characters in the browser information
        D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<int,struct std::pair<int const ,class std::basic_string<char,struct std::char_traits<char>,class std::a
llocator<char> > >,struct std::map<int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<int>,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator
<char> > > >::_Kfn,struct std::less<int>,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::iterator,bool>' being compiled
        D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\map(93) : while compiling class-template member function 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &__thiscall std::map<int,class std::basic
_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<int>,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::operator [](const int &)'
Linking...
pbavishiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkrCommented:
You can safely igonore these warnings, since they only refer to the symbol name length when debugging your application. From the compiler docs:

Compiler Warning (level 1) C4786
'identifier' : identifier was truncated to 'number' characters in the debug information

The identifier string exceeded the maximum allowable length and was truncated.

The debugger cannot debug code with symbols longer than 255 characters. In the debugger, you cannot view, evaluate, update, or watch the truncated symbols.

This limitation can be overcome by shortening identifier names.  The example code below demonstrates this method.

A trace mechanism can also be used to solve this problem. A trace mechanism is like the printf statements in the code. It keeps track of what is going on in an application during the debugging process. The _ASSERT, _ASSERTE, _RPTn and _RPTFn macros provide concise and flexible ways to perform the trace. These macros are not defined when _DEBUG is not defined. See Using Macros for Verification and Reporting for more information.

The example below demonstrates a situation that would cause this compiler warning to occur, and the solution to this problem.

 //sample1.cpp
 //In this program we have a class of a very long name.
 //We instantiate an object of that class type. We will
 //get multiple C4786 warnings.  The comments below
 //demonstrate the solution to this problem.

 #define a_really_long_class_name a_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really//_really_long_class_name

 //SOLUTION: Uncomment the lines below

 //#ifdef _DEBUG
 //#define a_really_long_class_name A_SHORT_CLASS_NAME
 //#endif

 class a_really_long_class_name
 {
 public:
   a_really_long_class_name() {};
   int m_data;
 };

 void main()
 {
    a_really_long_class_name test_obj;
    test_obj.m_data = 12;
 }

The following example demonstrate that templates with some long class names as their parameters can easily exceed the 255 character limit. Solutions to the problem are also provided.

 //sample2.cpp
 //SOLUTION1: uncomment the next 4 lines
 //#ifdef _DEBUG
 //#define VeryLongClassNameA A
 //#define VeryLongClassNameB B
 //#endif

 //SOLUTION2: An alternative solution:
 //uncomment the next 3 lines.
 //#ifdef _DEBUG
 //#define SomeRandomClass SRC
 //#endif

 template <class A1, class A2, class A3, class A4>
 class VeryLongClassNameA{};

 template <class B1, class B2, class B3>
 class VeryLongClassNameB{};

 template <class C1, class C2>
 class VeryLongClassNameC{};

 template <class D1>
 class VeryLongClassNameD{};

 class SomeRandomClass{};

 typedef VeryLongClassNameD<SomeRandomClass> ClassD ;
 typedef VeryLongClassNameC<SomeRandomClass, ClassD> ClassC;
 typedef VeryLongClassNameB<SomeRandomClass, ClassC, ClassD> ClassB;
 typedef VeryLongClassNameA<SomeRandomClass, ClassB, ClassC, ClassD> ClassA;

 void SomeRandomFunction(ClassA aobj){}

 void main()
 {
   ClassA AObj ;
   SomeRandomFunction(AObj) ;
 }
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jkrCommented:
BTW, this documentation can also be found at http://msdn.microsoft.com/library/en-us/vccore98/html/c4786.asp ("Compiler Warning (level 1) C4786")
0
SteHCommented:
Or you can use
#pragma warning (disable : 4786)
to disable the warning. Put it in a header file which gets included by all files where this occurs. This could be stdafx.h.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

pb_indiaCommented:
#pragma warning (disable : 4786)


Putting this didn;t help;
0
SteHCommented:
I am using it succesfully. Is it in the include before the STL headers? If not change the order.
0
pbavishiAuthor Commented:
#pragma warning (disable : 4786)
#include <time.h>
#include <string>
#include <map>
using namespace std;

Still no good.
0
jkrCommented:
May I ask who is asking that question? pbavishi or pb_india?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.