i write this program to split string in QtCreator
#include <QtCore/QCoreApplication>
#include <iostream>
#include <istream>
using namespace std;
int main()
{
string s("Somewhere down the road");
istringstream iss(s);
do
{
string sub;
iss >> sub;
cout << "Substring: " << sub << endl;
} while (iss);
return 0;
}
but it returns this error
main.cpp:23:24: error: variable ‘std::istringstream iss’ has initializer but incomplete type
why? what have i do ?
is there any other easy ways ?
thanks
You need to include the
<sstream>header for string streams.