0

I'm trying to make a University Course/ student management system in C++ for school assignment. I'm getting the following compiler error. Has anyone ever run into this before? I have the include statements.

PATH/User.h:15:20: error: ‘Course’ was not declared in this scope
   15 |  const std::vector<Course>& GetSchedule() const;
      |                    ^~~~~~
PATH/User.h:15:26: error: template argument 1 is invalid
   15 |  const std::vector<Course>& GetSchedule() const;
      |     
#include <iostream>
#include <string>
#include <vector>
#include "Course.h"
class User {
 public:
    const std::vector<Course>& GetSchedule() const;
 private:
    std::string Email;
    int Id;
    std::string Name;
    std::vector<Course> Schedule;
}

Here is my Course.h

#pragma once
#include <iostream>
#include <string>
#include <vector>
#include "Instructor.h"
#include "Student.h"
class Course {
 public:
    Course(const Instructor& instructor, std::string courseNum, bool isGraduateLevel);
    void PrintStudents();
    const std::vector<Course>& GetPrerequisites() const;
    void SetPrerequisites(const std::vector<Course>& prerequisites);
    const Instructor& GetInstructor() const;
    void SetInstructor(const Instructor& instructor);
    const std::vector<Student>& GetStudents() const;
    void SetStudents(const std::vector<Student>& students);
    const std::string& GetCourseNum() const;
    void SetCourseNum(const std::string& courseNum);
    bool IsGraduateLevel1() const;
    void SetIsGraduateLevel(bool isGraduateLevel);
    bool operator==(const Course& rhs) const;
    bool operator!=(const Course& rhs) const;
    class HashFunction {
     public:
        size_t operator()(const Course& course) const {
            return std::hash<std::string>()(course.GetCourseNum()) ^ std::hash<std::string>()(course.GetCourseNum());
        }
    };
 private:
    Instructor Instructor;
    std::vector<Student> Students;
    std::string CourseNum;
    bool IsGraduateLevel;
    std::vector<Course> Prerequisites;
};

0 Answers0