//#include <string>
You aren't including the <string>
header. You've commented out the include directive.
In the Visual C++ Standard Library implementation, std::string
can be used when you include <iostream>
, but the operator<<
overload that allows insertion of an std::string
into an std::ostream
is only included if you include the actual <string>
header.
If you want your code to be portable, you must include <string>
to use std::string
; which Standard Library headers are included by other headers is implementation-defined.