I am using a stringstream object as follows:
#include<iostream>
#include <istream>
using namespace std;
int main()
{
sting str="my.string";
std::stringstream message("HI this is firet line from initialization");
message << " second line " << " Continueing second line";
message << ", Add values: ";
message << str ;
std::cout<<"message value is :"<<message.str()<<std::endl;
return 0;
}
with the code above, it gives an error as follows:
error: variable 'std::stringstream message' has initializer but incomplete type
The error above is if I added the #include header file. but when i typed the message value. it becomes incomplete. that is, the value that I received from the message looks like this:
message value: second line. Continuation of the second line, Add values: my.string
any suggestion on why the first line is deleted on the output? thanks in advance
source
share