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;
}
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;
}
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