Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Suppress warning message C4786

12 views
Skip to first unread message

Norman Bullen

unread,
May 10, 2005, 9:48:32 AM5/10/05
to
Is there any way to suppress warning message C4786 in VC++ 6.0? This is
the message that says "'a very long name generated by a template' :
identifier was truncated to '255' characters in the debug information

I'm using STL and I'm getting hundreds of these, which makes it hard to
find warnings that I probably could (and should) do something about.

I've tried
#pragma warning( disable : 4786 )
and
#pragma warning( disable : C4786 )
and neither has any affect.

Norm
--
--
To reply, change domain to an adult feline.

Guido Stercken-Sorrenti [MVP VC++]

unread,
May 10, 2005, 10:28:18 AM5/10/05
to
>
> I've tried
> #pragma warning( disable : 4786 )
> and
> #pragma warning( disable : C4786 )
> and neither has any affect.
>

#pragma warning( disable : 4786 ) should work fine. Where have you put it?

--
Guido Stercken-Sorrenti
MVP - Visual Developer / Visual C++


Stoyan Damov

unread,
May 10, 2005, 10:29:46 AM5/10/05
to
Search for "STL without warnings" in Google, press "I'm feeling lucky"
you'll find what you need.
You just need Mad Google Skills(tm) :)

Cheers,
Stoyan

"Norman Bullen" <no...@BlackKittenAssociates.com.INVALID> wrote in message
news:QY2ge.370$OU1...@newsread3.news.pas.earthlink.net...

Axter

unread,
May 10, 2005, 3:39:01 PM5/10/05
to
If you have an stdafx.h file, try adding the code to disable the warnings
there.

You should avoid putting STL #include's in your header file.

With the #include's in your CPP file, try moving they're location up and
down, but always after the stdafx.h include.

And make sure it's before the "#ifdef _DEBUG"

Norman Bullen

unread,
May 10, 2005, 8:19:56 PM5/10/05
to
What the referenced web page
( http://www.codeproject.com/vcpp/stl/stl_without_warnings.asp )
tells me is that I probably can't do it.

Mr Wieland's code contains the following comment:

// BUG: C4786 Warning Is Not Disabled with #pragma Warning
// STATUS: Microsoft has confirmed this to be a bug in the Microsoft
product.
// This warning can be ignored. This occured only in the <map> container.

As it happens, I am using the map container so it looks like I'm out of
luck.

Norm

Carl Daniel [VC++ MVP]

unread,
May 10, 2005, 10:07:26 PM5/10/05
to
Norman Bullen wrote:
> What the referenced web page
> ( http://www.codeproject.com/vcpp/stl/stl_without_warnings.asp )
> tells me is that I probably can't do it.
>
> Mr Wieland's code contains the following comment:
>
> // BUG: C4786 Warning Is Not Disabled with #pragma Warning
> // STATUS: Microsoft has confirmed this to be a bug in the Microsoft
> product.
> // This warning can be ignored. This occured only in the <map>
> container.
> As it happens, I am using the map container so it looks like I'm out
> of luck.

I've found that 4786 can be disabled if you put it in your PCH file at the
top. I think it's not as clear-cut as "it never works".

-cd


Norman Bullen

unread,
May 11, 2005, 9:16:43 AM5/11/05
to
That does it! Thank you.

Dragos Cantemir

unread,
May 13, 2005, 3:40:15 AM5/13/05
to
Include disable4786.h file described here at the top of your stdafx.h file:
http://lists.boost.org/MailArchives/boost/msg25941.php
For me, this solution worked everytime. Thanks to Paul Hollingsworth
(the author of this incredible workaround).

Dragos


Mark Randall

unread,
May 13, 2005, 12:49:45 PM5/13/05
to
Statements dumped into the PCH apply to all your code - even the windows
ones, so dont go putting things like #define new DEBUG_NEW in there, or your
STL code will explode etc.

--
- Mark Randall
http://zetech.swehli.com

"Carl Daniel [VC++ MVP]" <cpdaniel_remove...@mvps.org.nospam>
wrote in message news:uvKMw4cV...@TK2MSFTNGP10.phx.gbl...

0 new messages