You can't use the same name for all your ifstream objects, otherwise how would you (or the compiler) be able to tell them apart?
1 2 3 4 5
ifstream file1("some file.foo");
ifstream file2("another file.foo"); // <- note it has a different name
ifstream file1("error.err"); // <- this will be a compiler error because you already
// have a 'file1' object
You can't use the same name for all your ifstream objects, otherwise how would you (or the compiler) be able to tell them apart?
You can use the same name for all your ifstream objects if they are processed sequentially.:)
Moreover you can place all them into std::initializer_list and use the range-based for statement to process them.
I'm making assumptions about what the OP's problem is based on what he said in his post.
OP wrote:
multiple ifstream loads and it claims to be prviously declared
I interpreted this to mean he has multiple ifstream objects with the same name. Hence why I replied with the response I did.
So yeah.. you're right... you can certainly use the same ifstream object to open multiple files in sequence... but I did not interpret OP's problem that way.