Thread: Maps with VC++6 - funny looking warnings

  1. #1
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986

    Maps with VC++6 - funny looking warnings

    Hey everyone

    I'm having some problems with Visual C++ 6.0 when I try to compile my http server that I' currently writing. Some of my classes use <map>'s, and I suspect thats where the problems are.

    This is part of the code:
    Code:
    #include <map>
    using namespace std;
    
    .....
    
    //----------------------------------------------------------------------------------------------------
    //			Virtual Host class - derived from configuration file
    //----------------------------------------------------------------------------------------------------
    class VIRTUALHOST
    {
      public:
    	string Name;							// Name of this virtual host (ie, RateMyPoo)
    	string HostName;						// Internet Address of host (www.ratemypoo.com)
    	string IndexFiles[10];					// Files that will be used as auto indexes of folders (index.htm)
    	string Root;							// Root folder of files for this VH (ie, c:\RateMyPoo)
    	string Logfile;							// Path/name of log file (C:\RateMyPoo\logfile.log)
    
    	//VIRTUALHOST(string ConfFile);			// Read in virtual hosts from files
    };
    
    //----------------------------------------------------------------------------------------------------
    //			Virtual Host Index (VHI) class. Keeps an index of all the Virtual hosts
    //----------------------------------------------------------------------------------------------------
    class VirtualHostIndex
    {
      public:
    	int NumberOfHosts;
    	map <char *, VIRTUALHOST> Host;			// Map Internet address to appropriate virtual host
    };
    This is a list of some of the 19 warning messages I get:
    Code:
    C:\Documents and Settings\Administrator\My Documents\Projects\SWS01\beta\main.cpp(205) : warning C4786: 'std::pair<std::_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kf
    n,std::less<char *>,std::allocator<VIRTUALHOST> >::const_iterator,std::_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kfn,std::less<char *>,std::allocator<VIRTUALHOST> >
    ::const_iterator>' : identifier was truncated to '255' characters in the debug information
    c:\program files\microsoft visual studio\vc98\include\xtree(182) : warning C4786: 'std::_Tree<char *,std::pair<char * const,char *>,std::map<char *,char *,std::less<char *>,std::allocator<char *> >::_Kfn,std::less<char *>,std::allocator<char *> >::~
    _Tree<char *,std::pair<char * const,char *>,std::map<char *,char *,std::less<char *>,std::allocator<char *> >::_Kfn,std::less<char *>,std::allocator<char *> >' : identifier was truncated to '255' characters in the debug information
    c:\program files\microsoft visual studio\vc98\include\xtree(182) : warning C4786: 'std::_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kfn,std::less<char *>,std::allocat
    or<VIRTUALHOST> >::~_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kfn,std::less<char *>,std::allocator<VIRTUALHOST> >' : identifier was truncated to '255' characters in
     the debug information
    c:\program files\microsoft visual studio\vc98\include\xtree(162) : warning C4786: 'std::_Tree<char *,std::pair<char * const,char *>,std::map<char *,char *,std::less<char *>,std::allocator<char *> >::_Kfn,std::less<char *>,std::allocator<char *> >::_
    Tree<char *,std::pair<char * const,char *>,std::map<char *,char *,std::less<char *>,std::allocator<char *> >::_Kfn,std::less<char *>,std::allocator<char *> >' : identifier was truncated to '255' characters in the debug information
    c:\program files\microsoft visual studio\vc98\include\xtree(162) : warning C4786: 'std::_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kfn,std::less<char *>,std::allocat
    or<VIRTUALHOST> >::_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kfn,std::less<char *>,std::allocator<VIRTUALHOST> >' : identifier was truncated to '255' characters in 
    the debug information
    c:\program files\microsoft visual studio\vc98\include\xtree(236) : warning C4786: '__ehhandler$?insert@?$_Tree@PADU?$pair@QADVVIRTUALHOST@@@std@@U_Kfn@?$map@PADVVIRTUALHOST@@U?$less@PAD@std@@V?$allocator@VVIRTUALHOST@@@3@@2@U?$less@PAD@2@V?$allocato
    r@VVIRTUALHOST@@@2@@std@@QAE?AU?$pair@Viterator@?$_Tree@PADU?$pair@QADVVIRTUALHOST@@@std@@U_Kfn@?$map@PADVVIRTUALHOST@@U?$less@PAD@std@@V?$allocator@VVIRTUALHOST@@@3@@2@U?$less@PAD@2@V?$allocator@VVIRTUALHOST@@@2@@std@@_N@2@ABU?$pair@QADVVIRTUALHOST
    @@@2@@Z' : identifier was truncated to '255' characters in the debug information
    c:\program files\microsoft visual studio\vc98\include\xtree(236) : warning C4786: '__unwindfunclet$?insert@?$_Tree@PADU?$pair@QADVVIRTUALHOST@@@std@@U_Kfn@?$map@PADVVIRTUALHOST@@U?$less@PAD@std@@V?$allocator@VVIRTUALHOST@@@3@@2@U?$less@PAD@2@V?$allo
    cator@VVIRTUALHOST@@@2@@std@@QAE?AU?$pair@Viterator@?$_Tree@PADU?$pair@QADVVIRTUALHOST@@@std@@U_Kfn@?$map@PADVVIRTUALHOST@@U?$less@PAD@std@@V?$allocator@VVIRTUALHOST@@@3@@2@U?$less@PAD@2@V?$allocator@VVIRTUALHOST@@@2@@std@@_N@2@ABU?$pair@QADVVIRTUAL
    HOST@@@2@@Z$0' : identifier was truncated to '255' characters in the debug information
    c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: 'std::pair<std::_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kfn,std::less<char *>,s
    td::allocator<VIRTUALHOST> >::iterator,bool>::pair<std::_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kfn,std::less<char *>,std::allocator<VIRTUALHOST> >::iterator,bool
    >' : identifier was truncated to '255' characters in the debug information
    c:\program files\microsoft visual studio\vc98\include\xtree(512) : warning C4786: '__unwindfunclet$?_Insert@?$_Tree@PADU?$pair@QADVVIRTUALHOST@@@std@@U_Kfn@?$map@PADVVIRTUALHOST@@U?$less@PAD@std@@V?$allocator@VVIRTUALHOST@@@3@@2@U?$less@PAD@2@V?$all
    ocator@VVIRTUALHOST@@@2@@std@@IAE?AViterator@12@PAU_Node@12@0ABU?$pair@QADVVIRTUALHOST@@@2@@Z$0' : identifier was truncated to '255' characters in the debug information
    I can't even read this stuff, and most of it talks about included files that I've never touched before (and don't intend to).

    I've heard that Visual C++ 6.0 isn't very good with templates, maybe thats what the problem is? If so, what can/should I do to stop these warnings, as I fear they may be changing some of my code (because it still compiles and runs, but doesn't seem to work properly).

    Any help on this matter is most appreciated :)

  2. #2
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    lol yeah I've searched the boards, but all they say is that VC6 is garbage when it comes to using templates. Doesn't really fix my problem though.... and I can't use Dev because I can't get winsock to work.

    Oh well, the code still compiles so it will have to do.

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    148
    The warning just means that you built a class which is too long for the debug information to hold. You can eliminate the warning (which is pretty harmless) by including:
    #pragma warning(disable:4786)

    That is an implementation error, not anything fundamental to C++ or STL. C++ implementations that use name mangling must be able to deal with very long names. 256 characters can be easily exceeded when templates are involved. STL is not special in that regard.

  4. #4
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    Thanks very much Wledge! That cut out 8 of the errors. Now I get
    Code:
    c:\program files\microsoft visual studio\vc98\include\xtree(182) : warning C4786: 'std::_Tree<char *,std::pair<char * const,char *>,std::map<char *,char *,std::less<char *>,std::allocator<char *> >::_Kfn,std::less<char *>,std::allocator<char *> >::~
    _Tree<char *,std::pair<char * const,char *>,std::map<char *,char *,std::less<char *>,std::allocator<char *> >::_Kfn,std::less<char *>,std::allocator<char *> >' : identifier was truncated to '255' characters in the debug information
    c:\program files\microsoft visual studio\vc98\include\xtree(182) : warning C4786: 'std::_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kfn,std::less<char *>,std::allocat
    or<VIRTUALHOST> >::~_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kfn,std::less<char *>,std::allocator<VIRTUALHOST> >' : identifier was truncated to '255' characters in
     the debug information
    c:\program files\microsoft visual studio\vc98\include\xtree(162) : warning C4786: 'std::_Tree<char *,std::pair<char * const,char *>,std::map<char *,char *,std::less<char *>,std::allocator<char *> >::_Kfn,std::less<char *>,std::allocator<char *> >::_
    Tree<char *,std::pair<char * const,char *>,std::map<char *,char *,std::less<char *>,std::allocator<char *> >::_Kfn,std::less<char *>,std::allocator<char *> >' : identifier was truncated to '255' characters in the debug information
    c:\program files\microsoft visual studio\vc98\include\xtree(162) : warning C4786: 'std::_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kfn,std::less<char *>,std::allocat
    or<VIRTUALHOST> >::_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kfn,std::less<char *>,std::allocator<VIRTUALHOST> >' : identifier was truncated to '255' characters in 
    the debug information
    c:\program files\microsoft visual studio\vc98\include\xtree(236) : warning C4786: '__ehhandler$?insert@?$_Tree@PADU?$pair@QADVVIRTUALHOST@@@std@@U_Kfn@?$map@PADVVIRTUALHOST@@U?$less@PAD@std@@V?$allocator@VVIRTUALHOST@@@3@@2@U?$less@PAD@2@V?$allocato
    r@VVIRTUALHOST@@@2@@std@@QAE?AU?$pair@Viterator@?$_Tree@PADU?$pair@QADVVIRTUALHOST@@@std@@U_Kfn@?$map@PADVVIRTUALHOST@@U?$less@PAD@std@@V?$allocator@VVIRTUALHOST@@@3@@2@U?$less@PAD@2@V?$allocator@VVIRTUALHOST@@@2@@std@@_N@2@ABU?$pair@QADVVIRTUALHOST
    @@@2@@Z' : identifier was truncated to '255' characters in the debug information
    c:\program files\microsoft visual studio\vc98\include\xtree(236) : warning C4786: '__unwindfunclet$?insert@?$_Tree@PADU?$pair@QADVVIRTUALHOST@@@std@@U_Kfn@?$map@PADVVIRTUALHOST@@U?$less@PAD@std@@V?$allocator@VVIRTUALHOST@@@3@@2@U?$less@PAD@2@V?$allo
    cator@VVIRTUALHOST@@@2@@std@@QAE?AU?$pair@Viterator@?$_Tree@PADU?$pair@QADVVIRTUALHOST@@@std@@U_Kfn@?$map@PADVVIRTUALHOST@@U?$less@PAD@std@@V?$allocator@VVIRTUALHOST@@@3@@2@U?$less@PAD@2@V?$allocator@VVIRTUALHOST@@@2@@std@@_N@2@ABU?$pair@QADVVIRTUAL
    HOST@@@2@@Z$0' : identifier was truncated to '255' characters in the debug information
    c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: 'std::pair<std::_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kfn,std::less<char *>,s
    td::allocator<VIRTUALHOST> >::iterator,bool>::pair<std::_Tree<char *,std::pair<char * const,VIRTUALHOST>,std::map<char *,VIRTUALHOST,std::less<char *>,std::allocator<VIRTUALHOST> >::_Kfn,std::less<char *>,std::allocator<VIRTUALHOST> >::iterator,bool
    >' : identifier was truncated to '255' characters in the debug information
    c:\program files\microsoft visual studio\vc98\include\xtree(512) : warning C4786: '__unwindfunclet$?_Insert@?$_Tree@PADU?$pair@QADVVIRTUALHOST@@@std@@U_Kfn@?$map@PADVVIRTUALHOST@@U?$less@PAD@std@@V?$allocator@VVIRTUALHOST@@@3@@2@U?$less@PAD@2@V?$all
    ocator@VVIRTUALHOST@@@2@@std@@IAE?AViterator@12@PAU_Node@12@0ABU?$pair@QADVVIRTUALHOST@@@2@@Z$0'
    I guess this might have something to do with the fact that I made a map with a class of my own... although I thought that would be ok. Any idea on what to do with those?

  5. #5
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    You'll need to put that #pragma directive in every single file that would generate such a warning. I used to stick them in the system headers that generated the bugged warnings, then I never had to worry about it if I started a new project.

  6. #6
    Registered User Casey's Avatar
    Join Date
    Jun 2003
    Posts
    47
    I just ignore those warnings. They do nothing except tell me that VC++ has a junky implementation. Why use an implementation-specific #pragma(I don't like pragmas if you can tell ) to remove something that is nothing more than a minor annoyance? You can remove the warnings by turning off all debugging capabilities, but that's just dumb.

  7. #7
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    MSVC specific......

    look up...

    #pragma warning(disable:4786)

    in your helpfiles.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  8. #8
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    Yeah thanks very much guys, I think I understand how #pragma works and I'll just have to live with the silly warnings. Oh well.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Task list in VC 2005
    By VirtualAce in forum Tech Board
    Replies: 0
    Last Post: 05-13-2008, 08:59 PM
  2. Warnings when using vector of vector
    By Boksha in forum C++ Programming
    Replies: 5
    Last Post: 03-29-2008, 01:54 PM
  3. Replies: 9
    Last Post: 03-14-2008, 09:55 AM
  4. map warnings and microsoft visual C++ 6.0
    By Geolingo in forum C++ Programming
    Replies: 6
    Last Post: 07-17-2003, 03:52 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM