Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C4786 & VC++ 6.0?

Status
Not open for further replies.

cpjust

Programmer
Sep 23, 2003
2,132
US
This is really starting to annoy me...
I'm stuck on a project that needs to be done in VC++ 6.0, so I've got all the broken STL that comes with it. I'm getting this error (multiple times) when I compile:
Code:
c:\program files\microsoft visual studio 6.0\vc98\include\xmemory(56) : warning C4786: '?address@?$allocator@V?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@st
d@@@2@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@std@@QBEPAV?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?
$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@AAV32@@Z' : identifier was truncated to '255' characters in the browser information
        c:\program files\microsoft visual studio 6.0\vc98\include\map(44) : see reference to class template instantiation 'std::allocator<class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class st
d::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class std::basic_string<char,struct std::
char_traits<char>,class std::allocator<char> > > > >' being compiled

I tried a #pragma warning( disable : 4786 ) but that didn't work. I even disabled warnings all together in the project settings, but the damn things just keep popping up! How do I kill a warning that won't die?
 
Insert
Code:
#pragma warning( disable: 4786 )
before your includes (or better in StdAfx.h before your includes - it's essential in precompiled headers case). Sometime it's OK to suppress C4787 too, so use
Code:
#pragma warning( disable: 4786 4786 )
It works.
 
Sorry for misprint in the post above:
Code:
#pragma warning( disable: 4786 4787 )
 
Oops, nevermind. I forgot to read the Note I added to my special VC++ 6.0 STL header file. doh! [noevil]
Code:
// stl_map.h:  This will include the <map> header file without any errors.
//
// Copyright 2004-2005 by Chris Just.  All Rights Reserved.
/////////////////////////////////////////////////////////////////////
#ifndef STL_MAP_HEADER
#define STL_MAP_HEADER

#if defined( _MSC_VER ) && (_MSC_VER <= 1200)	// 1200 = MSVC 6.0.
// This warning must be permanently disabled.
#	pragma warning(disable: 4503)	// 'decorated name length exceeded, name was truncated.

#	pragma once
#	pragma warning(push, 3)
#	pragma warning(disable: 4018)	// signed/unsigned mismatch.
#	pragma warning(disable: 4100)	// unreferenced formal parameter.
#	pragma warning(disable: 4245)	// conversion from 'type1' to 'type2', signed/unsigned mismatch.
#	pragma warning(disable: 4512)	// 'class' : assignment operator could not be generated.
#	pragma warning(disable: 4663)	// C++ language change: to explicitly specialize class template 'vector'.
#	pragma warning(disable: 4710)	// 'function' : function not inlined.
#	pragma warning(disable: 4786)	// identifier was truncated to 'number' characters in the debug information.
[COLOR=red]
// 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.
[/color]
#	include <map>

#	pragma warning(pop)
#else	// UNIX...
#	include <map>
#endif	// _MSC_VER <= 1200

#endif	// STL_MAP_HEADER
 
None the less it disables on my VC++ 6.0 installation...
 
Well I'll be damned... I was able to isolate the problem to <fstream> and fixed it by adding that #pragma before <fstream>.
I really hate VC++ 6.0. [thumbsdown]
 
I think it's expences of C++ templates (in the last analysis) - the most unfortunate and monstrous part of the language...
Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top