Public Group

# Warnings.

This topic is 5034 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Well Ive typed up a small tuttorial from a book ive got. When I compile it with VC++ 6.0 I get a whole boat load of warrings even though it works fine
C:\My Documents\C++ programs\learncpp\main.cpp(47) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_s
tring<char,std::char_traits<char>,std::allocator<char> > const &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,int>' : identifier was truncated to '255' characters in the debug information
C:\My Documents\C++ programs\learncpp\main.cpp(47) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<
char,std::char_traits<char>,std::allocator<char> > &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,int>' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\vector(39) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >
>::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\vector(60) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >
>::~vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information


Here's my code
// Word Jumble
// Hero's Inventory 2.0
// Demonstrates vectors

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{
vector<string> inventory;
inventory.push_back("sword");
inventory.push_back("armor");
inventory.push_back("shield");

cout << "You have " << inventory.size() << " items.\n";

cout << "\nYour items:\n";
for (int i = 0; i < inventory.size(); ++i)
cout << inventory << endl;

cout << "\nYou trade your sword for a battle axe.";
inventory[0] = "battle axe";
for (i = 0; i < inventory.size(); ++i)
cout << inventory << endl;

cout << "\nThe item name '" << inventory[0] << "' has ";
cout << inventory[0].size() << " letters in it.\n";

cout << "\nYour shield is destroyed in a fierce battle.";
inventory.pop_back();
cout << "\nYour items:\n";
for (i = 0; i < inventory.size(); ++i)
cout << inventory << endl;

cout << "\nYou were robbed of all of you possessions by a thief.";
inventory.clear();
if (inventory.empty())
cout << "\nYou have nothing.\n";
else
cout <<"\nYou have at least one item.\n";

return 0;
}


What exactly is causing this?

##### Share on other sites
This is one of the very few warnings you should ever ignore; for some reason, VC++ sees fit to warn you that some (nested template) STL types are too long to fit in the debug information. This is not a problem with your code. If memory serves, you can use a #pragma to squash warning C4786; refer to your VC++ documentation to see how exactly you can squash it (or wait until someone who's actually a Windows programmer comes by and replies to this thread ...).

##### Share on other sites
As Miserable states, warning C4786 can safely be ignored (there is nothing you can do about it anyway). Use this to turn off the warning:
#pragma warning ( disable: 4786 )

##### Share on other sites
That's nothing to worry about. It just that when you compile the code, debug symbols are generated by msvc so that you can step through the application and do general debuging. It's just that the deinition of some variables exceed the maximum number of allowable characters for a debug symbol (255 in this case). So they are truncated and then stored in the symbols database. The only problem is that these symbols cannot be "watched" in the debugger.

##### Share on other sites
Yeah, it's a limitation of VC6 that doesn't show up
in .NET 2003.

##### Share on other sites
Quote:
 Original post by Anonymous PosterYeah, it's a limitation of VC6 that doesn't show upin .NET 2003.

*sighs* Yes ive recently been hearing of these wonderfull limitations. >< Someday ill have the funds to buy .net.

1. 1
Rutin
24
2. 2
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 19
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631760
• Total Posts
3002176
×