Hello. Recently, I started digging C ++ and just decided to experiment, I wrote the following code:
#include <iostream> int main() { std::string text; std::cout << "Enter text: "; std::cin >> text; std::cout << "Text : " << text; }
After that, the medium wrote next to each <<
and >>
, where the text
variable was, the following:
Error: missing operator "<<" corresponding to these operands
I did not attach any importance to this and compiled it. Then the compiler gave me a terrible mistake. Here is only one of its first line (I didn’t write all because it’s very big):
[path] code \ code.cpp (10): error C2678: binary ">>": operator not found, accepting the left operand of the type "std :: istream" (or no acceptable conversion)
[path] \ include \ istream (1053): can be "std :: basic_istream <_Elem, _Traits> & std :: operator >>> (std :: basic_istream <_Elem, _Traits> &&, signed char *)
[path] code \ code.cpp (10): error C2678: binary ">>": operator not found, accepting the left operand of the type "std :: istream" (or no acceptable conversion)
[path] include \ istream (1053): can be "std :: basic_istream <_Elem, _Traits> & std :: operator >>> (std :: basic_istream <_Elem, _Traits> && signed char *)" `
[путь]
- path to the root folder of the studio or project.
Question: Where is my mistake and what have I done wrong? And of course how to fix it?