problem tryin to read from file

im trying to read some info from a file but im getting this compiler error

In member function ‘std::string FileReader::fileRead(std::string)’:
40: error: declaration of ‘std::ifstream file’ shadows a parameter

i made a file called test.txt in the same directory as my .cc programs.

line 40: ifstream file("test.txt");
(Note i have using namespace std; at top of my code)

what does the 'shadows a parameter' error mean?

P.S This is for an assignment, so im not going to post my whole source code
P.S.S Im coding on a mac using Xcode
This is a simple issue:
consider the following:

1
2
3
4
5
void somefunc (int x)
{
    double x; //error - it's all in the name

}



Mingw gives error code: Declaration of 'double x' shadows a parameter
MSVC gives: redefinition of formal parameter 'x'
Last edited on
arr such a simple mistake. thanks
Topic archived. No new replies allowed.