相关疑难解决方法(0)

错误C2679:二进制'>>':找不到哪个运算符采用'std :: string'类型的右手操作数(或者没有可接受的转换)

请不要与标题混淆,因为它已被某人询问,但不同的背景

Visual C++编译器(VS2008)中的以下代码未编译,而是抛出此异常:

std::ifstream input (fileName);   

while (input) {
  string s;
  input >> s;
  std::cout << s << std::endl;
};
Run Code Online (Sandbox Code Playgroud)

但是这个代码在cygwin g ++中编译得很好.有什么想法吗?

c++ cygwin compiler-errors visual-c++

31
推荐指数
1
解决办法
8万
查看次数

标签 统计

c++ ×1

compiler-errors ×1

cygwin ×1

visual-c++ ×1