Compilation error ostringstream

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hello,

I can't use STL class 'ostringsstream' in an VC++.net project, because
compilation produces the following error:

Microsoft Visual Studio .NET 2003\Vc7\include\ostream(243): error
C2039: 'failed': no element of
'std::ostreambuf_iterator<_Elem,_Traits>'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]




Here is my source code:

#include "stdafx.h"
#include <sstream>

int _tmain(int argc, _TCHAR* argv[])
{
std::ostringstream os;
int x = 1;
os << x;

return 0;
}


Is anyone knowing what's going wrong ?

thanks in advance

Michael
 
I can't use STL class 'ostringsstream' in an VC++.net project, because
compilation produces the following error:

Microsoft Visual Studio .NET 2003\Vc7\include\ostream(243): error
C2039: 'failed': no element of
'std::ostreambuf_iterator<_Elem,_Traits>'

Michael,

I don't have VC7 readily available to test, but your example builds
fine for me with VC 2005.

Dave
 
Michael said:
Hello,

I can't use STL class 'ostringsstream' in an VC++.net project, because
compilation produces the following error:

Microsoft Visual Studio .NET 2003\Vc7\include\ostream(243): error
C2039: 'failed': no element of
'std::ostreambuf_iterator<_Elem,_Traits>'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]




Here is my source code:

#include "stdafx.h"
#include <sstream>

int _tmain(int argc, _TCHAR* argv[])
{
std::ostringstream os;
int x = 1;
os << x;

return 0;
}


Is anyone knowing what's going wrong ?

thanks in advance

Michael
Your code also builds fine in my Visual Studio .NET 2003 (VC++ 7.1), which
appears to be what you're using.
I'd consider a repair install of Visual Studio.
 
pvdg42 said:
Michael said:
Hello,

I can't use STL class 'ostringsstream' in an VC++.net project, because
compilation produces the following error:

Microsoft Visual Studio .NET 2003\Vc7\include\ostream(243): error
C2039: 'failed': no element of
'std::ostreambuf_iterator<_Elem,_Traits>'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]




Here is my source code:

#include "stdafx.h"
#include <sstream>

int _tmain(int argc, _TCHAR* argv[])
{
std::ostringstream os;
int x = 1;
os << x;

return 0;
}


Is anyone knowing what's going wrong ?

thanks in advance

Michael
Your code also builds fine in my Visual Studio .NET 2003 (VC++ 7.1), which
appears to be what you're using.
I'd consider a repair install of Visual Studio.

You are right; I changed the file xutility.h unintentionally.
In declaration of the class ostreambuf_iterator the line
bool failed() const _THROW0()
was replaced by
boolfailed() const _THROW0()

Michael
 
Back
Top