mardi 28 avril 2015

I had a small program , which was generating compilation error:

following was the program:

#include <cstdio> 
#include <sstream>
int main()
{
   std::ostrstream  strm;                         
      strm.rdbuf()->freeze(0);                      
}

and I was getting following error on compilation: g++ sample3.cpp

sample3.cpp: In function 'int main()':
sample3.cpp:5: error: 'ostrstream' is not a member of 'std'
sample3.cpp:5: error: expected `;' before 'strm'
sample3.cpp:6: error: 'strm' was not declared in this scope

After searching in google , I suspect that i should use ostringstream in place ostrstream , so I have modified the programmm as blow:

#include <cstdio> 
#include <sstream>
int main()
{
   std::ostringstream  strm;                         
      strm.rdbuf()->freeze(0);                      
}

but after modification , I started getting following error:

g++ sample3.cpp
sample3.cpp: In function 'int main()':
sample3.cpp:6: error: 'struct std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >' has no member named 'freeze'

I tried to search in google and stackoverflow also but haven't got any idea about error , Can somebody please help me that what should I do here?

Aucun commentaire:

Enregistrer un commentaire