Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

BcS

Warnings making a vector of strings with VC++ 6.0

This topic is 5366 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

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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Yeah, I can get the student edition of Visual Stuido .NET 2003, so this may push me over the edge to make the purchase.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!