I am trying to write a program that reads in a list of strings from a file and checks what strings are missing from a second file and prints them to the screen. However, I am cu
This construct works for standard C++ 11 and newer compilers:
std::string filename;
//...
IN_FILE.open(filename);
This is basically the code you have now. However, the above will not work with pre-standard C++ 11 compilers (C++ 98, 03).
If you are compiling using a pre-standard C++ 11 compiler, then the code above should be:
std::string filename;
//...
IN_FILE.open(filename.c_str()); // Note the null-terminated const char *
Basically, the std::string
version of open
did not exist before C++ 11. Before C++ 11, you had to specify the name using a C-style, null-terminated string.
Thus the error you are seeing is because you are compiling in a version of C++ before C++ 11.