Thread: MSVC++ error query

  1. #1
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002

    MSVC++ error query

    This function:

    vector<string> split (const string& s) // function that splits a string and inserts the individual
    {									   // words into a vector<string>
         vector<string> ret;
         typedef string::size_type string_size;
         string_size i = 0;
         while (i != s.size())
              while (i != s.size() && isspace(s[i]))  // finds the first non-space char - will be at position i
              string_size j = i;
              while (j != s.size() && !isspace(s[j])) // finds the first space character after i - will be at position j
              if (i != j) // if any words have been found
                   ret.push_back(s.substr(i, j-i)); // pushes back the word found between i and j
                   i = j;
         return ret;
    works fine under code-warrior, but i get the following warning when compiling with MSVC:

    C:\Program Files\Microsoft Visual Studio\MyProjects\test\test.cpp(38) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std: :char_traits<char>,std::allocator<char> > const *,std::basic_string<char,std::char_traits<char>,st d::allocator<c
    har> >,std::basic_string<char,std::char_traits<char>,st d::allocator<char> > const &,std::basic_string<char,std::char_traits<char>,st d::allocator<char> > const *,int>' : identifier was truncated to '255' characters in the debug information


  2. #2
    S­énior Member
    Join Date
    Jan 2002
    because MSVC only uses identifiers up to 255 characters long. When using templates it's quite easy to generate long identifiers so you've gone over this limit. It's telling you that it'll only use the first 255 characters as a debugging symbol. You can't solve the underlying problem (it won't affect how the code executes), but you can suppress the warning messages by placing -

    #pragma warning (disable:4786)

    before you inlcude the headers.

  3. #3
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002
    Thanks for the info. Sorensen.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trouble with MSVC, Mingw32 and Code::Blocks
    By Brafil in forum C Programming
    Replies: 11
    Last Post: 10-12-2009, 11:34 AM
  2. MSVC resource script in Dev-C++
    By josh_d in forum Windows Programming
    Replies: 0
    Last Post: 03-17-2004, 04:07 PM
  3. MSVC behaves strange
    By ripper079 in forum C++ Programming
    Replies: 4
    Last Post: 10-28-2003, 08:34 PM
  4. Blender3D, XML, and MSVC ???
    By Grumpy_Old_Man in forum Game Programming
    Replies: 0
    Last Post: 08-24-2003, 07:00 PM
  5. GCC (cygwin) much faster than MSVC, Borland?
    By Sargnagel in forum C Programming
    Replies: 15
    Last Post: 08-05-2003, 03:15 AM