Solved

STL in VC++ 5.0 and warning C4786

Posted on 1998-07-06
5
239 Views
Last Modified: 2010-08-05
I am using STL and MS Visual Developper Studio. I get tons of such Warnings:
'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,enum CVolInstr::Typ>,std::map<std:
:basic_string<char,std::char_traits<char>,std::allocator<char>>,enum CVolInstr::Typ,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::allocator<enum CVolInstr::Typ>>::_Kfn,std::less<std::basic_string<char,std::char_
traits<char>,std::allocator<char>>>,std::allocator<enum CVolInstr::Typ>>::iterator' : identifier was truncated to '255' characters in the debug information

They are rather annoying, since one hardly finds the errors among tons of such warnings. Apart from that, i wonder why they appear at all. Can I enlarge the debuggers symbol table, so it will be happy with these long names. Or can a switch the warning off somhow? Or can i tell the Compiler to genrate shorter Symbolnames?

How can i get rid of those warnings?
0
Comment
Question by:Adelmo
  • 3
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 1167247
answer coming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1167248
You can use a pre-processor #pragma directive, like

#pragma warning(disable: XXXX)

where XXXX is the number of the warning you want to get rid of.  (I believe the warning you want to get rid of is C4786, if so, you would just type the 4786).  The warning number will display at the start of the warning message so you can find it there.

You need to place this directive before the STL header is included.

Now for the bad news.  This pragma does not always work, probably due to a bug or design flaw in VC.  This error is one in particular that it doesn't always work with.  (I have this problem a lot and sometimes cases the pragma works and in some cases it is ignored.)  You'll just have to try and see if it works.
0
 

Author Comment

by:Adelmo
ID: 1167249
I put this pragma in front of all headers, where som STL code is inlcuded and it worked for me.

Tnx

0
 
LVL 22

Expert Comment

by:nietod
ID: 1167250
Good.  You may find cases where it doesn't.  It seems random, but it seems stable, that is if it prints at a particular piece fo code, it always will, and nothing will change that.
0
 

Author Comment

by:Adelmo
ID: 1167251
Thanks, I'll try to remember that.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now