Thread: wostringstream... what header?

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    125

    wostringstream... what header?

    Simple question with, hopefully, a simple answer...
    what headers/preprocessor directives should I use to be able to use wostringstream, wostream, etc?
    I've got both the iostream and sstream headers included and ostringstream and ostream work just fine, but I can't seem to get to wostringstream to work; they simply undeclared and I can't seem to find anything about it through Google or the forum search.
    I'm using DevCpp 4.9.9.2 with Mingw/GCC 3.4.2, programming under Windows XP.
    Thanks in advance.
    Last edited by Boksha; 11-29-2006 at 03:33 PM.
    Typing stuff in Code::Blocks 8.02, compiling stuff with MinGW 3.4.5.

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    <sstream> should be enough for wostringstream, and <ostream> should be enough for wostream (or did you mean wofstream, which is in <fstream>?).

    Post a tiny program that doesn't compile if you are still getting errors.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    125
    Code:
    #include <ostream>
    
    void testfunction( std::wostream &testvar )
    {
    }
    
    int main(int argc, char *argv[])
    {
      return 0;
    }
    Errors:

    3 C:\Test\main.cpp `wostream' undeclared in namespace `std'
    3 C:\Test\main.cpp `testvar' was not declared in this scope
    4 C:\Test\main.cpp variable or field `testfunction' declared void
    4 C:\Test\main.cpp syntax error before `{' token
    C:\Test\Makefile.win [Build Error] [main.o] Error 1
    Typing stuff in Code::Blocks 8.02, compiling stuff with MinGW 3.4.5.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    MinGW has a known lack of support for wide-character versions of the C++ standard library stuff. You can use the STLport C++ standard library as a replacement for the library MinGW comes with. That would gain you these components.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    Mar 2002
    Posts
    125
    I was sort of afraid it'd come to this... this is quite a setback.
    Thanks for the info and help. I'll give STLport a go, although installing it to work with Dev-C++ seems rather daunting at the moment, so for now I'll just use an alternative solution not involving streams.
    Typing stuff in Code::Blocks 8.02, compiling stuff with MinGW 3.4.5.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Obtaining source & destination IP,details of ICMP Header & each of field of it ???
    By cromologic in forum Networking/Device Communication
    Replies: 1
    Last Post: 04-29-2006, 02:49 PM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM