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?

1 Answer 1

1

You possibly forgot

#include<string>

And you should call the type std::string.

std::string m ="kosala";
Sign up to request clarification or add additional context in comments.

2 Comments

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
@KosalaJayakody stackoverflow.com/questions/4338067 I believe this answered your original question? If you have a new question, I recommend asking a new question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.