0

Is it possible to use sstream header in mingw 2.95 compiler?.If, it is, then how? I am using C-Free 4.0 and it comes with default mingw2.95 and cygwin compiler

Stals
  • 1,543
  • 4
  • 27
  • 52
N. F.
  • 891
  • 3
  • 9
  • 33

2 Answers2

0

sstream is header file that is part of c++ standard library. It is not optional or specific to the gcc compiler. You should be able to include it simply like this:

#include <sstream>

Make sure you are compiling with g++ and not gcc.

anio
  • 8,903
  • 7
  • 35
  • 53
  • And you must compile the source as c++ code. If you compile it as C code, including `sstream` wont work. (use a .cpp or similar file extention will probably work) – rve Aug 25 '12 at 06:33
  • I am compiling it through an IDE, I am not aware on the command it uses in this case – N. F. Aug 25 '12 at 07:55
  • @MiNdFrEaK What IDE? Look around in the settings and find the compiler your are invoking. – anio Aug 25 '12 at 19:13
0

g++ 2.95 is really from the stone age. There was no <sstream> at that time. (A lot of other things are missing too or don't work like they do in more recent compilers.) It comes only with the obsolete <strstream> which is based on char*.

Your options are:

  • Get a newer compiler. Almost anything newer will do.
  • If you are really forced to use this one for some reason, you can copy sstream from gcc 3.x. That worked for me at that time. But be prepared for more surprises.
  • Stick with strstream but that's ugly...
rtlgrmpf
  • 431
  • 2
  • 6