-2

I want to use std::stringstream like a private variable in my class. But i have an error "undeclared identifier". PLease, explain why and get me advice how can i do this.

class Test
{
private:
    std::stringstream str;    
}
Artyom Rusak
  • 27
  • 1
  • 5
  • 3
    What error are you getting? – maditya Mar 30 '13 at 11:06
  • 5
    *"But i have an error"* is as useful as "my cat could be on fire". Please always include the complete error report, including burning cats and line numbers – Zeta Mar 30 '13 at 11:07
  • @Zeta You're my hero. Too bad I didn't perceive your presence sooner around here. Your light yet useful and teaching sarcasm pleases me. –  Mar 30 '13 at 11:23
  • It's so demoralizing to see your downvotes. The question had been edited well. Moreover, It's solve my problem for the similar question. Yet, much snowball effect in SO... :-), You Shall have my first Upvote. – Yeo Sep 17 '15 at 18:31

1 Answers1

2

Most likely you haven't included the proper header file. Also, don't forget the semicolon at the end of the class definition:

#include <sstream> // <== This is what you need for std::stringstream

class Test
{
private:
    std::stringstream str;    
}; // <== Don't forget the semicolon
Andy Prowl
  • 124,023
  • 23
  • 387
  • 451