In the main program I have #include "school.h" in the header. I have the error
from schoolMain.cpp In file included from school.h:5, from schoolMain.cpp
some common other errors are:
student.h expected unqualified-id before '.' token
student.h variable or field `setID' declared void
from what I've read, this is either a include error or a syntax error. the code for school is:
Expand|Select|Wrap|Line Numbers
- #ifndef school_H
- #define school_H
- #include <string>
- #include "student.h"
- #include "unit.h"
- class school
- {
- public:
- School() {myStudents.resize(1); myUnits.resize(1)};
- ~School();
- void addStudentUnit(string studentName, string unitName);
- void printUnitsOfStudent(string studentName) const;
- void printStudentsOfUnit(string unitName) const;
- bool studentExists(string studentName, int &size);
- bool unitExists(string unitName, int &size)
- private:
- vector<student> myStudents();
- vector<unit> myUnits;
- }
- #endif
Expand|Select|Wrap|Line Numbers
- #ifndef unit_H
- #define unit_H
- #include <iostream>
- #include <string>
- class student;
- class unit
- {
- public:
- unit() {unitName = ""; pupils.resize(1);};
- void setUnitName(string name);
- string getUnitName() const;
- string getPupil();
- void addPupil(student *p);
- void printPupils() const;
- private:
- string unitName;
- vector<student *> pupils;
- }
- #endif
Expand|Select|Wrap|Line Numbers
- #ifndef stu_H
- #define stu_H
- #include <iostream>
- #include <string>
- class unit.h;
- class student
- {
- public:
- student() {id=""; units.resize(1);};
- void setID(string name);
- string getID() const;
- void addUnit(*unit);
- void printUnits() const;
- private:
- string id;
- vector<unit *> units;
- }
- #endif
Salty