Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I declare a string in my program: "string is undeclared identifier"

Tags:

People also ask

How do you solve a string not declared in this scope?

You have the following options: Write using namespace std; after the include and enable all the std names: then you can write only string on your program. Write using std::string after the include to enable std::string : then you can write only string on your program. Use std::string instead of string.

What is undeclared identifier?

The identifier is undeclaredIf the identifier is a variable or a function name, you must declare it before it can be used. A function declaration must also include the types of its parameters before the function can be used.


I can't declare a string in my program:

string MessageBoxText = CharNameTextBox->Text;

it just doesn't work. It says string is undeclared identifier. What am I missing in the namespace or include or something like that?