Solved

STL in VC++ 5.0 and warning C4786

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Quicksort a dynamic deque 33 73
object oriented programming on screen browser tutorial lesson 2 82
Error C2678: binary '!=': no operator found... 4 61
Outlook 13 45
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

820 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