Тема: Помилка при компіляції програми
Ось завдання
Ось код моєї програми:
Headerfile.h
#pragma once
#include<iostream>
#include<fstream>
#include<cstring>
#include<iomanip>
using namespace std;
int menu();
void output_data(bool& key);
void add_new();
void read_file(bool& key);
void write_file();
void find_data(string GroupName, bool& key);
class student_ALL {
public:
    string student_surname;
    string nameof_facult;
    string nameof_group;
    int num = 0;
};Headerfile.cpp
#include"Headerfile.h"
student_ALL student;
ofstream writeNewObject;
ifstream read;
string name = "DataBase_studens.txt";
int menu() {
    int answer;
    cout << "0 - Exit"
        << endl << "1 - Add new student"
        << endl << "2 - Search student, use group_name"
        << endl << "3 - Get all list of students"; cin >> answer;
        return answer;
}
void output_data(bool& key) {
    if (!key) {
        cout << "|" << setw(20) << right << "Surname"
            << "|" << setw(20) << right << "Number"
            << "|" << setw(20) << right << "Faculty"
            << "|" << setw(20) << right << "Group" << "|" << endl;
        key = true;
    }
    cout << "|" << setw(20) << right << student.student_surname
        << "|" << setw(20) << right << student.num
        << "|" << setw(20) << right << student.nameof_facult
        << "|" << setw(20) << right << student.nameof_group << "|" << endl;
}
void add_new() {
    cout << "Write surname (on English): "; cin >> student.student_surname;
    cout << "Write name of facult: "; cin >> student.nameof_facult;
    cout << "Write name of group: "; cin >> student.nameof_group;
    cout << "Enter number of group: "; cin >> student.num;
}
void read_file(bool& key) {
    read.open(name);
    while (read.read((char*)&student, sizeof(student_ALL))) {
        if (read.eof())
            break;
        output_data(key);
    }
    read.close();
}
void write_file() {
    writeNewObject.open(name, fstream::app);
    writeNewObject.write((char*)&student, sizeof(student_ALL));
    writeNewObject.close();
}
void find_data(string nameof_group, bool key) {
    read.open(name);
    while (read.read((char*)&student, sizeof(student_ALL))) {
        if (read.eof())
            break;
        if (nameof_group == student.nameof_group)
            output_data(key);
    }
    read.close();
}Main.cpp
#include"Headerfile.h"
int main() {
    bool key = false;
    while (true) {
        key = false;
        system("cls");
        switch (menu()) {
        case 0: {
            return 0;
        }system("pause"); break;
        case 1: {
            add_new();
            write_file();
        }system("pause"); break;
        case 2: {
            read_file(key);
            break;
        }system("pause"); break;
        case 3: {
            string name;
            cout << "Write name of group, what you want to seek: "; cin >> name;
            find_data(name, key);
        }system("pause"); break;
        default: {
            cout << "Warning dates!!!";
        }system("pause"); break;
        }
    }
}
