我正在使用stringstream的对象如下:
#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; }
error: variable 'std::stringstream message' has initializer but incomplete type
一旦我添加了“#include”头文件,就会解决上面的错误.但是当我打印出消息的价值时.它变得不完整了.即我得到的消息的价值如下:
消息值为:第二行继续第二行,添加值:my.string