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

Compiler warning 4786

338 views
Skip to first unread message

News

unread,
Aug 17, 1999, 3:00:00 AM8/17/99
to
Hello,

I suspect that this is in a faq somewhere, but I can't find it. I am getting
hundreds
of C4786 warnings when using the stl utilities.h. Including

#pragma warning( disable : 4786 )

at the head of the offending .cpp file doesn't help.

I would be grateful for any help.

Jon

jsbe...@uswest.net


Terje Sandstrøm

unread,
Aug 18, 1999, 3:00:00 AM8/18/99
to
Is it possible that you've included utilities.h in your stdafx.h file, thus
having it precompiled ? If so, move the pragma warning into the stdafx.h
file before the line where you include utilities.h

Terje

News wrote in message ...

Steve Feldman

unread,
Aug 18, 1999, 3:00:00 AM8/18/99
to
As has been pointed out on other occasions in the NG, this warning indicates
an overly long identifier name, and occurs frequently with templated
declarations, and can usually be safely ignored. The #pragma has worked for
me; now, however, I see KB Article ID: Q167355 which seems to sound like
this pragma is known to fail and is an acknowledged bug.

Note: a) I am using VC 6.0 - this KB article says that the bug pertains to
5.0. Perhaps it has been fixed. What version of VC are you using? b) It
looks like the pragma only fails on warnings that do not have a file name
and line number in them.

Nick Ambrose

unread,
Aug 18, 1999, 3:00:00 AM8/18/99
to
Still not fixed in 6.0SP3 Maybe in 7.0 ???
Do as the previous poster suggested - make sure it's in your stdafx,h file if
you are using precompiled headers.

Nick

Bruce Dawson

unread,
Aug 20, 1999, 3:00:00 AM8/20/99
to
It doesn't matter whether you have precompiled headers, however it
does matter that you get the #pragma in front of absolutely every
relevant definition - typically that means before you include your container
header file, and it sounds like it also means before you include utilities.

I find it amusing that Microsoft doesn't seem to realize that this pragma
does work - if you place it correctly.

Nick Ambrose wrote:

> Still not fixed in 6.0SP3 Maybe in 7.0 ???
> Do as the previous poster suggested - make sure it's in your stdafx,h file if
> you are using precompiled headers.
>
> Nick
>
> Steve Feldman wrote:
>
> > As has been pointed out on other occasions in the NG, this warning indicates
> > an overly long identifier name, and occurs frequently with templated
> > declarations, and can usually be safely ignored. The #pragma has worked for
> > me; now, however, I see KB Article ID: Q167355 which seems to sound like
> > this pragma is known to fail and is an acknowledged bug.

--
.Bruce Dawson, Cavedog Entertainment.
Makers of Total Annihilation - http://www.cavedog.com

Christof Ahrendt

unread,
Sep 16, 1999, 3:00:00 AM9/16/99
to
I Just Added this pragma right before the deklaration of a

typedef std::map< ++++,+++++> MapName;

in the headerfile, and all warnings have disapeared!

Worked for me perfectly! Thanks

yours Christof

News schrieb:


>
> Hello,
>
> I suspect that this is in a faq somewhere, but I can't find it. I am getting
> hundreds
> of C4786 warnings when using the stl utilities.h. Including
>
> #pragma warning( disable : 4786 )
>
> at the head of the offending .cpp file doesn't help.
>
> I would be grateful for any help.
>
> Jon
>
> jsbe...@uswest.net

--
Dies war eine Nachricht von Christof Ahrendt
ahr...@student.uni-kassel.de

Chuck England - MVP

unread,
Sep 27, 1999, 3:00:00 AM9/27/99
to
There are certain STL containers (noteably map<>) which require the pragma
prior to the the header. (#include <map> in this case) Also, you may need
4800 as well. You can put them in the same pragma as follows:
#pragma warning(disable: 4786 4800)
However, this will not help you with the REAL problem. When you go to debug,
since the names are too long for the current version of VC 6.0 SP3, you want
see anything in the debugger. Hopefully they will fix this in VC7.

Chuck England - MVP
---


News wrote in message ...

Martin Nolte [MS]

unread,
Nov 15, 1999, 3:00:00 AM11/15/99
to
Hi Chuck,

there is a knowledgebase article that describes the behavior that you've
mentioned:

PRB: C4786 After Porting from Version 5.0 to Version 6.0
ID: Q195386

The solution to suppress the warnings is described there: Use the pragma
directive before
you include any STL headers to disable the warnings.


Best Regards,

Martin Nolte
Microsoft GmbH


attachment.
PRB: C4786 After Porting from Version 5.0 to Version 6.0
ID: Q195386

----------------------------------------------------------------------------
----
The information in this article applies to:

Microsoft Visual C++, 32-bit Editions, version 6.0

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


SYMPTOMS
When building a project with Visual C++ 6.0 that compiles without a C4786
warning in Visual C++ 5.0, you may receive C4786 warnings, sometimes
followed by:

Fatal Error C1033: cannot open program database 'vc60.pdb'.

RESOLUTION
In Visual C++ 5.0, using the following


#pragma warning (disable : 4786)
after including STL headers, disables the warning:
C4786:'identifier' : identifier was truncated to 'number' characters in the
debug information.
However, this method does not disable all such warnings in Visual C++
version 6.0. The occurrence of many C4786 warnings may result in the
following:
C1033 error: cannot open program database 'vc60.pdb'.
Use the pragma directive before you include any STL headers to disable the
warnings.

STATUS
This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

// compile options required: /Zi /GX
#include <iostream>
#include <string>
#include <map>

// move this pragma before the includes above to disable the
file://C4786 warnings
#pragma warning (disable : 4786)

int main () {
using namespace std;
map<int,string> m;
m[0] = "hello world";
cout << m[0] << endl;

return 0;
}

REFERENCES
For additional information, please see the following articles in the
Microsoft Knowledge Base:

Q122539 BUG: C4786 or C1067 Caused by Long Identifier and /Zi

Q167355 BUG: C4786 Warning Is Not Disabled with #pragma Warning

Additional query words: kbDSupport


Keywords : kbCompiler kbSTL kbVC600
Version : WINNT:6.0
Platform : winnt
Issue type : kbprb

Last Reviewed: July 9, 1999


----------------------------------------------------------------------------
----
Send feedback to MSDN.Look here for MSDN Online resources.


"Chuck England - MVP" <Cryst...@email.msn.com> wrote in message
news:OZiWfvOC$GA.197@cppssbbsa03...

0 new messages