Warnings making a vector of strings with VC++ 6.0

Started by
2 comments, last by BcS 20 years, 6 months ago
Hi. I'm dipping my toe into the waters of the STL. But I've already run into some weird warnings I don't get. All I've tried to do is make a vector of strings:

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

int main() 
{

    vector<string> v;
    string s("Hello STL");
    v.push_back(s);
    cout << v[0] << endl;

	return 0;
}
The program runs and displays 'Hello STL', but I get a mess of warnings from my compiler (MS VC++ 6.0): Configuration: test1 - Win32 Debug-------------------- Compiling... test1.cpp c:\program files\microsoft visual studio\myprojects\chapter_3\test1.cpp(15) : warning C4786: 'std::reverse_iterator,std::allocator > const *,std::basic_string,std::alloc ator >,std::basic_string,std::allocator > const &,std::basic_string,std::allocator > const *,int>' : identifier was truncated to '255' characters in the debug information c:\program files\microsoft visual studio\myprojects\chapter_3\test1.cpp(15) : warning C4786: 'std::reverse_iterator,std::allocator > *,std::basic_string,std::allocator >,std::basic_string,std::allocator > &,std::basic_string,std::allocator > *,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::allocator >,std::allocator,std::allocator > > >::vector,std::allocator >,std::allocator,std::allocator > > >' : 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::allocator >,std::allocator,std::allocator > > >::~vector,std::allocator >,std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information Linking... test1.exe - 0 error(s), 4 warning(s) Am I doing something wrong? Thanx. [edited by - BcS on October 9, 2003 9:52:53 PM]
Advertisement
quote:Original post by BcS
Hi. I''m dipping my toe into the waters of the STL. But I''ve already run into some weird warnings I don''t get. All I''ve tried to do is make a vector of strings:

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

int main()
{

vector v;
string s("Hello STL");
v.push_back(s);
cout << v[0] << endl;

return 0;
}

The program runs and displays ''Hello STL'', but I get a mess of warnings from my compiler (MS VC++ 6.0):

Configuration: test1 - Win32 Debug--------------------
Compiling...
test1.cpp
c:\program files\microsoft visual studio\myprojects\chapter_3\test1.cpp(15) : warning C4786: ''std::reverse_iterator,std::allocator > const *,std::basic_string,std::alloc
ator >,std::basic_string,std::allocator > const &,std::basic_string,std::allocator > const *,int>'' : identifier was truncated to ''255'' characters in the debug information
c:\program files\microsoft visual studio\myprojects\chapter_3\test1.cpp(15) : warning C4786: ''std::reverse_iterator,std::allocator > *,std::basic_string,std::allocatorhar> >,std::basic_string,std::allocator > &,std::basic_string,std::allocator > *,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::allocator >,std::allocator,std::allocator > >
>::vector,std::allocator >,std::allocator,std::allocator > > >'' : 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::allocator >,std::allocator,std::allocator > >
>::~vector,std::allocator >,std::allocator,std::allocator > > >'' : identifier was truncated to ''255'' characters in the debug information
Linking...

test1.exe - 0 error(s), 4 warning(s)


Am I doing something wrong?

Thanx.


If you really want to have some fun, set the warning level to the maximum. I did this once, and I had several hundred warnings. Only two of them were in code I wrote. The other couple hundred were in MS''s header files, lol.
A lot of people put this in their stdafx.h or any header file to suppress those warnings in VC++ 6.

#pragma warning( disable : 4786 )  // disable browser symbol truncation warning (stl templates) 


Of course if you can afford it (or you have access to the student edition) I''d recommend upgrading to VC++ 2003, since it offers a lot better STL support.
Yeah, I can get the student edition of Visual Stuido .NET 2003, so this may push me over the edge to make the purchase.

This topic is closed to new replies.

Advertisement