For Programmers: Free Programming Magazines  


Home > Archive > VC STL > March 2006 > ostringstream cannot be compiled?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ostringstream cannot be compiled?
nick

2006-03-16, 7:01 pm

The following code cannot be compiled.

#include <iostream>
//#include <sstream>
//#include <iomanip>
#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
std::ostringstream ss;
//ss << 1.2;
//cout << ss.str();
return 0;
}

The error is:
c:\test\test.cpp(13): error C2079: 'ss' uses undefined class
'std::basic_ostringstream<_Elem,_Traits,_Alloc>'
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Alloc=std::allocator<char>
]

Any clue? Thanks
nick

2006-03-16, 7:01 pm

btw, i tried to #include <sstream> too. it also doesn't work.

"nick" wrote:

> The following code cannot be compiled.
>
> #include <iostream>
> //#include <sstream>
> //#include <iomanip>
> #include "stdafx.h"
>
> int _tmain(int argc, _TCHAR* argv[])
> {
> std::ostringstream ss;
> //ss << 1.2;
> //cout << ss.str();
> return 0;
> }
>
> The error is:
> c:\test\test.cpp(13): error C2079: 'ss' uses undefined class
> 'std::basic_ostringstream<_Elem,_Traits,_Alloc>'
> with
> [
> _Elem=char,
> _Traits=std::char_traits<char>,
> _Alloc=std::allocator<char>
> ]
>
> Any clue? Thanks

Igor Tandetnik

2006-03-16, 9:57 pm

"nick" <nick@discussions.microsoft.com> wrote in message
news:99FFD645-CA5C-4997-A2C0-5CB2A022F0E9@microsoft.com
> The following code cannot be compiled.
>
> #include <iostream>
> //#include <sstream>
> //#include <iomanip>
> #include "stdafx.h"


When using precompiled headers, the compiler ignores everything that
comes above #include "stdafx.h" line. Make sure it's the first
non-comment line in your .cpp file.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com