Hi,
While trying a program from "C++ Primer 3rd Edition" by Stannley Lippman, I encountered with following two errors.
1. The book says that the header file fstream also includes the header iostream, so including just fstream will do. But g++ complained about cout, cin and cerr despite having fstream included and namespace std used properly. Does it mean that fstream does not include iostream, or is it specific to g++ compiler.
2. I was trying to create and initialize an ofstream object as below
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
void do_something()
{
string fname;
cin >> fname;
ofstream fout(fname);
}
g++ did not compile this and says that there is no matching call for the last statement. Isn't there a constructor in the class ofstream which accepts a string object as argument?