Qt version 5.01
Platform windows 64 bit
Issues:error: no operand "<<" matches these operands
I have looked into the web but could not able to find solution for it. I have tried lots of things but it doesnt work. If I change QString to std::string, then it compile properly . But then I will lossing sprintf functionality of QString which I need it.
ii) Secondly I have tried to delcare same function name in header file with extern keyword as suggested by someone in other forum but it doesnt work. SO May you guys please let know where I am making mistake. Below is my code
#include <sstream>
#include <QString>
#include <string>
#include <QTime>
namespace
{
std::ostream& operator <<(std::ostream& os , const QTime& system_time )
{
QString buffer ;
const double seconds = double( system_time.second() ) + ( system_time.msec()/1000.0 ) ;
buffer.sprintf( "%02i:%02i:%06.3f", system_time.hour(), system_time.minute(), seconds );
os << buffer; // error here
return os;
}
}
Thanks and regards,
QString cannot be output that simply unless you overload the << operator.
Try this:
or