ToDo::ToDo(Family* famList)
{
cout << "\nCreating ToDo...\n";
cout << "\nChecking for appts.txt file...\n";
ifstream apptFile("c:\\appts.txt");
if(apptFile.is_open())
{
cout << "\nFile found.\n";
cout << "\nRealizing appt.txt...\n";
for(int k = 0;!apptFile.eof();++k)
{
Person p;
time_t time;
char s1[SHRTNAME];
apptFile >> time;
apptFile >> s1;
Date d(time);
p = famList.search(s1); //compile error "famList not part of class"
Appointment a(&p, d);
addAppt(&a);
}
}
else
cout << "\nFile not found.\n";
apptFile.close();
}
I keep getting the compile error that famList needs to be part of a class. I believe the problem being with the header files and ToDo not being aware of the Family class, but I've added a #include family.hpp in the todo.hpp, yet I'm still receiving the same compile error. Here's my todo.hpp file in case it helps pinpoint the problem.
Would this fix my original compile error though? I'd try to run it right now but I'm not home. Is not de-referencing the object causing the "needs to be part of a class" error?
Edit: Yup, de-referencing the object fixed it, it compiles now. It crashes at the ToDo constructor, but I just need to debug my newly added code now :p