Error identifier "xxxx" is undefined

Trying to fix the error below not sure why I am getting it.

I overloaded the >> istream in my CTest class

1
2
CTest ::CTest (string name, int id, string color) //constructor
ifstream & operator>>(ifstream & fin, CTest & rhs) //header 


This is in my main
1
2
3
4
ifstream fin = openInput("file.txt");
... code reading data from fin...
CTest temp("name",1,"color"); //no errors here 
fin >> temp; //Error identifier temp is undefined 


Yes, I included all the header files
Last edited on
have you declared fin somewhere?
Last edited on
Yes fin has been declared, but it is saying "temp is undefined"
is there any code of the constructor ?
maybe you have done something wrong in there
Do you have defined a default ctor? Can you test your operator>> with an object created with this?

I think you can post more code if you want to get some help.
Topic archived. No new replies allowed.