vector - char 255 warning

This is a discussion on vector - char 255 warning within the C++ Programming forums, part of the General Programming Boards category; I'm getting this compile message based on the below sample code. Yet I've populated a vector with strings in other ...

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    128

    vector - char 255 warning

    I'm getting this compile message based on the below sample code. Yet I've populated a vector with strings in other ways and not seen the compilte error:
    c:\program files\microsoft visual studio\vc98\include\vector(60) : warning C4786: 'std::vector<std::basic_string<char,std::char_trai ts<char>,std::allocator<char>
    >,std::allocator<std::basic_string<char,std::char_ traits<char>,std::allocator<char> > >

    >::~vector<std::basic_string<char,std::char_traits <char>,std::allocator<char>
    >,std::allocator<std::basic_string<char,std::char_ traits<char>,std::allocator<char> > > >' :
    identifier was truncated to '255' characters in the debug information

    Code:
    #include <vector>
    #include <string>
    #include <iostream.h>
    
    void main()
    {
    
    //Declaration for the string data
    std::string strData = "One";
    //Declaration for C++ vector
    std:: vector <std::string> str_Vector;
    str_Vector.push_back(strData);
    strData = "Two";
    str_Vector.push_back(strData);
    strData = "Three";
    str_Vector.push_back(strData);
    strData = "Four";
    str_Vector.push_back(strData);
    
    }
    Using MSVC++ 6.0

    NEVER MIND:
    "You can ignore these warnings.

    They're a well known bug with the compiler.

    You can remove them via following code:
    #pragma warning( disable : 4786)"
    Last edited by FoodDude; 10-05-2005 at 08:49 AM.

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,804
    They are not a bug... but yes, this particular warning is unimportant and can be ignored. It also only shows up in debug builds so if you were to switch to a release build it would disappear.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,687
    The void main is another thing though...
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dynamically allocating 3D array
    By ssharish2005 in forum C Programming
    Replies: 8
    Last Post: 02-26-2008, 03:07 PM
  2. strange number problem
    By kkjj in forum C Programming
    Replies: 9
    Last Post: 08-09-2007, 07:30 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 12:03 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM

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