在Dev C++
编译器中,我可以编写并成功编译此代码:
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string method;
cin >> method;
return 0;
}
但是当我在上面的代码中写Visual Studio 2013 (console app mode)
了这个错误:
Error: no operator ">>" matches these operands
operand types are: std::istream >> std::string
在Visual Studio
:
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string method;
cin >> method;
return 0;
}
我知道错误告诉我什么。但是为什么只有这样Visual Studio 2013
呢?
尝试将标头“ stdafx.h”放在其他标头之前。
#include "stdafx.h"
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句