file.open(file, ios::in);
You have named your
fstream
file, and the first parameter, which should be a
char*
(see
basic_fstream Class | Microsoft Docs[
^]) you have also named
file
. So the compiler thinks you are trying to pass a
fstream
object to the
open
method of a
fstream
, which makes no sense.
Don't use names like file for anything as it can easily conflict with actual types. Use sensible meaningful names, it will save you headaches in future.