0
string m ="kosala";
ui->label_5->setText(m);

This gives me :

string is undeclared identifier

I want to use string data type as in here without QString type. How can i do that?

IAmInPLS
  • 4,051
  • 4
  • 24
  • 57

1 Answers1

1

You possibly forgot

#include<string>

And you should call the type std::string.

std::string m ="kosala";
Drew Dormann
  • 59,987
  • 13
  • 123
  • 180
  • drew , i did like that also but it gives like this error .... error: C2664: 'QLabel::setText' : cannot convert parameter 1 from 'std::string' to 'const QString &' Reason: cannot convert from 'std::string' to 'const QString' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called – Kosala Jayakody Jul 19 '15 at 01:41
  • @KosalaJayakody http://stackoverflow.com/questions/4338067 I believe this answered your original question? If you have a new question, I recommend [asking a new question](http://stackoverflow.com/questions/ask). – Drew Dormann Jul 19 '15 at 01:49