You may receive C4786 warnings when you try to build a project in Visual C++ 5.0 or in Visual C++ 6.0 (195386)



The information in this article applies to:

  • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
  • Microsoft Visual C++, 32-bit Professional Edition 6.0
  • Microsoft Visual C++, 32-bit Learning Edition 6.0

This article was previously published under Q195386

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
   //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 more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

122539 BUG: C4786 or C1067 caused by long identifier and /Zi

167355 FIX: C4786 warning is not disabled with #pragma warning


Modification Type:MajorLast Reviewed:6/2/2005
Keywords:kbtshoot kberrmsg kbCompiler kbprb kbSTL KB195386 kbAudDeveloper