Solved

STL in VC++ 5.0 and warning C4786

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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.
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.

910 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

16 Experts available now in Live!

Get 1:1 Help Now