Reputation: 19
I found this compiling error very odd . error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::istream' (or there is no acceptable conversion) I'm compiling under MVC++ Express 2010 here's the code :
The error indicate that it's from line 8 .
1 int m;
2 vector <string> grid;
3
4 cin >> m;
5
6 for(int i=0; i<m; i++) {
7 string s;
8 cin >> s;
9 grid.push_back(s);
10 }
Upvotes: 0
Views: 11491
Reputation: 2243
In my case, the error appeared when I did this:
volatile int a;
std::cin << a;
Obviously, the << operator is not overloaded for volatile int and thus removing 'volatile' is the solution.
Upvotes: 0
Reputation: 70931
You need to #include <string>
. Also if you don't have them add #include <iostream>
and #include <vector>
.
Upvotes: 5