开发者

functions that work with mingw don't work with vc++.NET

I have a very simple program

#include <cstdlib>
#include <iostream>
using namespace std;
int main(){
string something;
cout << "Enter Something:" << endl;
cin >> something;
return 0;
}

this does gives me the error of

ThePath: error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion) wh开发者_JAVA技巧ats wrong did I not download the platform sdk right

or is this a little bug in the msdn library

I have also figured out that this: getline(cin, SomeString, '\n'); gives me this error

ThePath : error C3861: 'getline': identifier not found

the simple question is why?

why is this happening?

thanks

Luck


you probably need to include string in the header

#include <string>


You are referring to names from the std namespace (like string or cin) without qualifying the names with std::. For the names to be found you should use std::string and std::cin etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜