maps in Visual Studio 6.0

This is a discussion on maps in Visual Studio 6.0 within the C++ Programming forums, part of the General Programming Boards category; Hello, I want to use maps in Visual Studio 6.0. However, declaring Code: map<char *, int> asdf; Gives many warnings: ...

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    224

    maps in Visual Studio 6.0

    Hello,

    I want to use maps in Visual Studio 6.0. However, declaring
    Code:
    	map<char *, int> asdf;
    Gives many warnings:
    Code:
    c:\program files\microsoft visual studio\vc98\include\xtree(200) : warning C4786: '?rbegin@?$_Tree@PADU?$pair@QADH@std@@U_Kfn@?$map@PADHU?$less@PAD@std@@V?$allocator@H@2@@2@U?$less@PAD@2@V?$allocator@H@2@@std@@QAE?AV?$reverse_bidirectional_iterator@
    Viterator@?$_Tree@PADU?$pair@QADH@std@@U_Kfn@?$map@PADHU?$less@PAD@std@@V?$allocator@H@2@@2@U?$less@PAD@2@V?$allocator@H@2@@std@@U?$pair@QADH@3@AAU43@PAU43@H@2@XZ' : identifier was truncated to '255' characters in the browser information
            c:\program files\microsoft visual studio\vc98\include\map(46) : see reference to class template instantiation 'std::_Tree<char *,struct std::pair<char * const,int>,struct std::map<char *,int,struct std::less<char *>,class std::allocator<int>
     >::_Kfn,struct std::less<char *>,class std::allocator<int> >' being compiled
    
    c:\mydir\myprog.cpp(187) : warning C4786: 'std::reverse_bidirectional_iterator<std::_Tree<char *,std::pair<char * const,int>,std::map<char *,int,std::less<char *>,std::allocator<int> >::_Kfn,std::less<char *>,std::allocator<int> >:
    :const_iterator,std::pair<char * const,int>,std::pair<char * const,int> const &,std::pair<char * const,int> const *,int>' : identifier was truncated to '255' characters in the debug information
    How can I avoid these warnings? Or is this a compiler limitation? They get in the way of other warnings/errors I have.

    Thanks.

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,319
    Those warnings are common in VC++ 6.0. You can ignore them. To stop them from being shown, you can use #pragma warning(disable: 4786) at the top of your file, or at the top of the VC++ include file itself. If you search for C4786 you'll find a lot of information on it.

    BTW, you should be careful of using char* in a map. The C++ string class might be a better choice depending on what you are trying to do.

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    224
    Thanks for the fast response.
    That doesn't seem to work. I still get the C4786 warnings. Is there something else I need to have?

  4. #4
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,681
    The beginning of your program should look something like this:
    Code:
    #pragma warning(disable:4786)
    
    #include <map>
    
    ... rest of your code goes here as normal ...
    If you've done that then you shouldn't be seeing those warnings when compiling. If you put the #pragma after the #include <map> line you would still get the warnings. The #pragma must come before the #include <map> line (I think that's how it goes).

    ...or, just compile in release mode instead of debug mode and those warnings will go away on their own.
    I used to be an adventurer like you... then I took an arrow to the knee.

  5. #5
    Registered User
    Join Date
    Sep 2003
    Posts
    224
    Thanks, that worked.
    However, when I try to add elements to a map, I get the following warnings:
    Code:
    c:\program files\microsoft visual studio\vc98\include\utility(23) : warning C4786: '??0?$pair@Viterator@?$_Tree@VCString@@U?$pair@$$CBVCString@@I@std@@U_Kfn@?$map@VCString@@IU?$less@VCString@@@std@@V?$allocator@I@3@@3@U?$less@VCString@@@3@V?$allocat
    or@I@3@@std@@_N@std@@QAE@ABViterator@?$_Tree@VCString@@U?$pair@$$CBVCString@@I@std@@U_Kfn@?$map@VCString@@IU?$less@VCString@@@std@@V?$allocator@I@3@@3@U?$less@VCString@@@3@V?$allocator@I@3@@1@AB_N@Z' : identifier was truncated to '255' characters in
     the browser information
            c:\program files\microsoft visual studio\vc98\include\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<class CString,struct std::pair<class CString const ,unsigned int>,struct std::map<class CString,unsigne
    d int,struct std::less<class CString>,class std::allocator<unsigned int> >::_Kfn,struct std::less<class CString>,class std::allocator<unsigned int> >::iterator,bool>' being compiled
            c:\program files\microsoft visual studio\vc98\include\map(93) : while compiling class-template member function 'unsigned int &__thiscall std::map<class CString,unsigned int,struct std::less<class CString>,class std::allocator<unsigned int> >
    ::operator [](const class CString &)'
    c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: 'std::pair<std::_Tree<CString,std::pair<CString const ,unsigned int>,std::map<CString,unsigned int,std::less<CString>,std::allocator<unsigned int> >::_Kfn,std::less<C
    String>,std::allocator<unsigned int> >::iterator,bool>::pair<std::_Tree<CString,std::pair<CString const ,unsigned int>,std::map<CString,unsigned int,std::less<CString>,std::allocator<unsigned int> >::_Kfn,std::less<CString>,std::allocator<unsigned i
    nt> >::iterator,bool>' : identifier was truncated to '255' characters in the debug information
    Linking...
    Last edited by Yasir_Malik; 09-25-2006 at 12:56 PM.

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,805
    >Is there something else I need to have?
    A better compiler.
    My best code is written with the delete key.

  7. #7
    Registered User
    Join Date
    Sep 2003
    Posts
    224
    I want to add that I only get those warnings, where as before, I was getting a sargasso of repeated warnings.

  8. #8
    Registered User
    Join Date
    Jan 2005
    Posts
    7,319
    I just edited the files that actually gave the warnings and add the pragma to the pragmas at the top of the files. I think you might have to save the file, then close down MSDev before re-compiling, but I'm not sure. The fact that there are fewer warnings means you are getting closer at least.

  9. #9
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,470
    As predlude said, MSVC++6.0 is quite dated now. If you got your hands on a more up to date compiler you may rid yourself of the warnings. Try DevC++4.992 or code::blocks IDE

    If you want to stick with Mictorsoft, they are handing out MSVC++2005 express edition for free download from their site, it may be a big advantage to you later on to have a more standard compilant compiler - if not, you will run into more errors as you go along

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 09:43 AM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21