so many warnings

L

Lasse Skyum

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 said:
,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
,int,std::less<std::basic_string<char,std::char_traits<char>,std::allocator
::_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
 
D

Dave

Lasse Skyum said:
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 said:
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!
 
K

Kevin Saff

Lasse Skyum said:
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.
 
K

Karl Heinz Buchegger

Lasse said:
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).
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top