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::cout
and std::endl
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With