Solved

STL in VC++ 5.0 and warning C4786

Posted on 1998-07-06
5
249 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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

778 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