Please don’t confuse with the title as it was already asked by someone but for a different context
The below code in Visual C++ Compiler (VS2008) does not get compiled, instead it throws this exception:
std::ifstream input (fileName);
while (input) {
string s;
input >> s;
std::cout << s << std::endl;
};
But this code compiles fine in cygwin g++. Any thoughts?
Have you included all of the following headers?
<fstream><istream><iostream><string>My guess is you forgot
<string>.On a side note: That should be
std::coutandstd::endl.