Sign in to follow this  

Warnings.

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

If you intended to correct an error in the post then please contact us.

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
Linking...


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[i] << endl;

	cout << "\nYou trade your sword for a battle axe.";
	inventory[0] = "battle axe";
	for (i = 0; i < inventory.size(); ++i)
		cout << inventory[i] << 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[i] << 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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Guest Anonymous Poster
Yeah, it's a limitation of VC6 that doesn't show up
in .NET 2003.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Yeah, it's a limitation of VC6 that doesn't show up
in .NET 2003.


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

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this