Archived

This topic is now archived and is closed to further replies.

Weird warning messages

This topic is 5501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to do something like this where I return a list of strings (in this case, I'm using a vector)
    
vector<string> getStrings (){
   vector<string> strings;
   // fill strings some how

   return strings;
}

// somewhere else in the code

vector<string> st = getStrings(); // this is where

                                  // main.cpp(112) is   

                                  // located

    
It will compile, but I get these 10 warnings:
quote:
vector(48): warning C4786: '??0?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator @D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V? $allocator@D@2@@std@@@2@@std@@QAE@IABV?$basic_string@DU?$char_traits @D@std@@V?$allocator@D@2@@1@ABV?$allocator@V?$basic_string@DU?$ char_traits@D@std@@V?$allocator@D@2@@std@@@1@@Z' : identifier was truncated to '255' characters in the browser information main.cpp(112): see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled vector(61): warning C4786: '??0?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator @D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V? $allocator@D@2@@std@@@2@@std@@QAE@PBV?$basic_string@DU?$char_traits @D@std@@V?$allocator@D@2@@1@0ABV?$allocator@V?$basic_string@DU?$ char_traits@D@std@@V?$allocator@D@2@@std@@@1@@Z' : identifier was truncated to '255' characters in the browser information main.cpp(112): see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled vector(103): warning C4786: '?rbegin@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$ allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits @D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE?AV?$reverse_iterator@ PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ V12@AAV12@PAV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information main.cpp(112): see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled vector(105): warning C4786: '?rbegin@?$vector@V?$basic_string@DU?$char_traits@D@std@@V? $allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits @D@std@@V?$allocator@D@2@@std@@@2@@std@@QBE?AV?$reverse_iterator @PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@ @V12@ABV12@PBV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information main.cpp(112): see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled vector(107): warning C4786: '?rend@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$ allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits @D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE?AV?$reverse_iterator @PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std @@V12@AAV12@PAV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information main.cpp(112): see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled vector(108): warning C4786: '?rend@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$ allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits @D@std@@V?$allocator@D@2@@std@@@2@@std@@QBE?AV?$reverse_iterator @PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std @@V12@ABV12@PBV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information main.cpp(112): see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled main.cpp(119): warning C4786: 'std::reverse_iterator,std::allocator > const *,std::basic_string, std::allocator >, std::basic_string , std::allocator > const &, std::basic_string, std::allocator > const *, int>' : identifier was truncated to '255' characters in the debug information main.cpp(119): warning C4786: 'std::reverse_iterator,std::allocator > *,std::basic_string, std::allocator >, std::basic_string, std::allocator > &,std::basic_string, std::allocator > *,int>' : identifier was truncated to '255' characters in the debug information vector(60): warning C4786: 'std::vector, std::allocator >,std::allocator,std::allocator > > >::~vector, std::allocator >, std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information Linking...
There are two separate warning messages I'm getting:
identifier was truncated to '255' characters in the debug information

see reference to class template instantiation 'some ugly thing listed here' being compiled
  
The first warning looks obnoxious, but harmless and will probably go away if I change to the release profile. But the second one is what concerns me. Is it a problem? There is some reason it is warning me about that. Also, does the source above look like the best way to do that? Perhaps there is a better way that won't get me all these warning messages. Thanks for your help. edit: fixed formatting [edited by - spiffgq on November 21, 2002 11:58:22 AM]

Share this post


Link to post
Share on other sites
This warning is due to the fact that when operating with templated functions and classes the compiler generates internal identifiers with different type-names than you specify (among other things, in order to differentiate between different templated versions of the functions and classes).
Due to Visual Studio being particularily inept it actually generates identifiers longer than it is capable of handling, and that''s what the warning says.
That long string with @''s and $''s and such is the internal representation, and Visual Studio complains that this identifier is longer than 255 characters (which is what it can handle), even though it generated those identifiers on it''s own.
You can safely ignore those warnings (especially as there is nothing you can do to stop VS from generating those identifiers). To tell VS that you''re not interested in these particular warnings, do

#pragma warning(disable:4786)

before you include the string and vector headers.

-Neophyte

Share this post


Link to post
Share on other sites