错误C2678:binary'>> :无操作符,找到一个类型为“std :: istream”的左手操作数(或没有可接受的转换) [英] error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::istream' (or there is no acceptable conversion)
本文介绍了错误C2678:binary'>> :无操作符,找到一个类型为“std :: istream”的左手操作数(或没有可接受的转换)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现这个编译错误很奇怪。
错误C2678:二进制'>>':无操作符,它接受类型为'std :: istream'的左手操作数(或没有可接受的转换)
我在MVC ++ Express 2010这里的代码:
错误表明它来自第8行。
1 int m;
2 vector< string>格;
3
4 cin>> m;
5
6 for(int i = 0; i 7 string s;
8 cin>> s;
9 grid.push_back(s);
10}
解决方案
c $ c> #include< string> 。此外,如果您没有添加 #include< iostream>
和 #include< vector>
/ p>
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 }
解决方案
You need to #include <string>
. Also if you don't have them add #include <iostream>
and #include <vector>
.
这篇关于错误C2678:binary'>> :无操作符,找到一个类型为“std :: istream”的左手操作数(或没有可接受的转换)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文