#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]
Warnings making a vector of strings with VC++ 6.0
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:
quote:Original post by BcSIf 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.
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.
A lot of people put this in their stdafx.h or any header file to suppress those warnings in VC++ 6.
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.
#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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement