I am having problem in declaring StringStream in QT.
Here is my code:
std::stringstream ss;
for (int i = 0; i <= path.length()-1; ++i)
{
if (path[i] == '\\')
{
ss << "\\\\";
}
else
{
ss << path[i];
}
}
path = QString::fromStdString(ss.str());//store the stringstream to a string
return path;
the error message is:
aggregate 'std::stringstream ss' has incomplete type and cannot be defined;
Mixing
QStringandstd::stringor related is not generally a good idea. You should implement that withQStringmethods likereplace( QChar ch, const QString & after, Qt::CaseSensitivity cs = Qt::CaseSensitive).BTW, you can’t use QString directly with any of the standard
stdstreams, there are no overloads defined. TheqPrintablefunction can help though. And you need to include<sstream>to usestd::stringstream.