so many warnings

Discussion in 'C++' started by Lasse Skyum, Oct 20, 2003.

  1. Lasse Skyum

    Lasse Skyum Guest

    When compiling in Debug mode with MSVC++ 6.0 and using STL, I get 237
    warnings about strings beeing truncated to 255 characters. The program runs
    just fine but I'm sick of the warnings :-o Any ideas?

    This doesn't happen in Release mode...

    --
    Lasse

    ----------------

    One of the warnings:

    Warning C4786:
    'std::pair<std::_Tree<std::basic_string<char,std::char_traits<char>,std::all
    ocator<char>
    >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<cha

    r> > const ,int>,std::map<std::basic_string<char,std::char_traits<cha
    r>,std::allocator<char>
    >,int,std::less<std::basic_string<char,std::char_traits<char>,std::allocator

    <char> > >,std::allocator<int>
    >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocat

    or<char> > >,std::allocator<int> >::iterat
    or,bool>' : identifier was truncated to '255' characters in the debug
    information
     
    Lasse Skyum, Oct 20, 2003
    #1
    1. Advertising

  2. Lasse Skyum

    Dave Guest

    "Lasse Skyum" <no spam> wrote in message
    news:3f940d94$0$27387$...
    > When compiling in Debug mode with MSVC++ 6.0 and using STL, I get 237
    > warnings about strings beeing truncated to 255 characters. The program

    runs
    > just fine but I'm sick of the warnings :-o Any ideas?
    >
    > This doesn't happen in Release mode...
    >
    > --
    > Lasse
    >
    > ----------------
    >
    > One of the warnings:
    >
    > Warning C4786:
    >

    'std::pair<std::_Tree<std::basic_string<char,std::char_traits<char>,std::all
    > ocator<char>
    >
    >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<cha
    > r> > const ,int>,std::map<std::basic_string<char,std::char_traits<cha
    > r>,std::allocator<char>
    >
    >,int,std::less<std::basic_string<char,std::char_traits<char>,std::allocator
    > <char> > >,std::allocator<int>
    >
    >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocat
    > or<char> > >,std::allocator<int> >::iterat
    > or,bool>' : identifier was truncated to '255' characters in the debug
    > information
    >
    >


    Put this at the top of your source file:

    #pragma warning(disable: 4786)

    Just as a friendly tip, questions specific to VC++ might be more likely to
    be answered on microsoft.public.vc.language, but I'm glad I was able to help
    out with this question!
     
    Dave, Oct 20, 2003
    #2
    1. Advertising

  3. Lasse Skyum

    Kevin Saff Guest

    "Lasse Skyum" <no spam> wrote in message
    news:3f940d94$0$27387$...
    > When compiling in Debug mode with MSVC++ 6.0 and using STL, I get 237
    > warnings about strings beeing truncated to 255 characters. The program

    runs
    > just fine but I'm sick of the warnings :-o Any ideas


    This is MSVC's way of warning you of its inadequacies. You will want to add
    the line

    #pragma warning (disable : 4786)

    liberally throughout your headers.
     
    Kevin Saff, Oct 20, 2003
    #3
  4. Lasse Skyum wrote:
    >
    > When compiling in Debug mode with MSVC++ 6.0 and using STL, I get 237
    > warnings about strings beeing truncated to 255 characters. The program runs
    > just fine but I'm sick of the warnings :-o Any ideas?
    >
    > This doesn't happen in Release mode...
    >


    If you read the message carefully (I know its hard to do that since it is that
    long), you notice that it ends in:

    ... identifier was truncated to '255' characters in the debug information

    Note especially the last 2 words: debug information.

    The compiler is telling you that the info he leaves in the executable for
    the debugger may be invalid because it had to truncate it.

    For program execution this has no effect, it's just that your debugger
    might operate in funny ways.

    To get rid of this message (which according to Microsoft documentation
    can be safely ignored) put a

    #pragma warning( 4786: disable )

    as the very first line in your source file (before all the includes).

    --
    Karl Heinz Buchegger
     
    Karl Heinz Buchegger, Oct 21, 2003
    #4
  5. Lasse Skyum

    Lasse Skyum Guest

    Thanks a lot guys, it works just fine now!
     
    Lasse Skyum, Oct 21, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VB Programmer
    Replies:
    2
    Views:
    2,059
    VB Programmer
    Feb 10, 2006
  2. Rhino
    Replies:
    33
    Views:
    1,334
    Oliver Wong
    Dec 22, 2005
  3. Tom Allison

    many many warnings...

    Tom Allison, Jul 29, 2006, in forum: Ruby
    Replies:
    2
    Views:
    131
    Yukihiro Matsumoto
    Jul 30, 2006
  4. Ab Cd
    Replies:
    25
    Views:
    405
    Michael T. Richter
    Jan 23, 2007
  5. Ted Sung
    Replies:
    1
    Views:
    330
    Sherm Pendley
    Aug 30, 2004
Loading...

Share This Page