Подскажите, пожалуйста, как исправить ошибку, мучаюсь уже третий день
user.h
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include "table.h"
#include "latte.h" //классы из паттерна "Декоратор"
#include "coffee.h"
#include "dish.h"
#include "order.h"
#include "discount.h"
#include <iostream>
#include <string>
#include<windows.h>
#include <ctime>
#include <fstream>
#include <vector>
using namespace std;
class user
{
protected:
int right=0; //право, которое отвечает за определенные возможности персонала
double salary;//заработанная сумма за смену
int id;
string name;
string surname;
string patronymic;
tm working;
public:
user();
void print_u();
void new_table(vector <table*> &t);
void setRight(int v);
void setSalary(double v);
void setId(int v);
int getId()const;
int getRight()const;
double getSalary()const;
void setName(string v);
void setSurname(string v);
void setPatroymic(string v);
string getName()const;
string getSurname()const;
string getPatronymic()const;
void open_shift();
void close_shift();
virtual ~user() = default;
virtual void add_order() = 0;
};
user.cpp
#include "user.h"
user::user()
{
name = "nothing";
right = 0;
salary = 0;
}
void user::print_u()
{
cout << "Name: " << name << endl;
cout << "Surname: " << surname << endl;
cout << "Patronymic: " << patronymic << endl;
cout << "ID: " << id << endl;
}
void user::new_table(vector<table*> &t)
{
t.push_back(new order());
int code=-1;
int i = 0;
while (code != 0)
{
cout << "Enter the code of dish -> ";
cin >> code;
if (code == 1)
{
t.push_back(new latte(t[i]));
i++;
}
if (code == 2)
{
t.push_back(new coffee(t[i]));
i++;
}
if (code ==3)
{
t.push_back(new discount(t[i]));
i++;
}
}
}
void user::setRight(int v)
{
right = v;
}
void user::setSalary(double v)
{
salary = v;
}
void user::setId(int v)
{
id = v;
}
int user::getId() const
{
return id;
}
int user::getRight() const
{
return right;
}
double user::getSalary() const
{
return salary;
}
void user::setName(string v)
{
name = v;
}
void user::setSurname(string v)
{
surname = v;
}
void user::setPatroymic(string v)
{
patronymic = v;
}
string user::getName() const
{
return name;
}
string user::getSurname() const
{
return surname;
}
string user::getPatronymic() const
{
return patronymic;
}
void user::open_shift()
{
time_t rawtime;
struct tm* timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
working.tm_sec = timeinfo->tm_sec;
working.tm_min = timeinfo->tm_min;
working.tm_hour = timeinfo->tm_hour;
}
void user::close_shift()
{
time_t rawtime;
struct tm* timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
string buf;
buf = surname + " " + name + " " + patronymic + ".txt";
fstream fs;
string h;
double s = 0;
fs.open(buf, ios::in);
while (!fs.eof())
{
getline(fs, h);
s = atof(h.c_str());
cout << s << endl;
cout << h << endl;
}
fs.close();
fs.open(buf, ios::out);
working.tm_sec = timeinfo->tm_sec - working.tm_sec;
working.tm_min = timeinfo->tm_min - working.tm_min;
working.tm_hour = timeinfo->tm_hour - working.tm_hour;
if (working.tm_sec < 0)
{
working.tm_min--;
working.tm_sec = 60 + working.tm_sec;
}
if (working.tm_min < 0)
{
working.tm_hour--;
working.tm_min = 60 + working.tm_min;
}
if (working.tm_hour > 14)
{
working.tm_sec = 0;
working.tm_min = 0;
working.tm_hour = 0;
}
s= s +salary * (working.tm_sec + working.tm_min * 60 + working.tm_hour * 3600);
cout << s;
fs << s;
fs.close();
}
waiter.h
#pragma once
#include "user_one.h"
class waiter:public user_one
{
public:
waiter();
void add_order() override;
};
waiter.cpp
#include "waiter.h"
waiter::waiter(): user_one()
{
right = 2;
}
void waiter::add_order()
{
cout << " ";
}
Source
#include "user_one.h"
#include "waiter.h"
using namespace std;
int main()
{
waiter a;
vector <table*> tables;
a.new_table(tables);
cout << tables[tables.size() - 1]->add_dish();
}
Скажите, пожалуйста, что мне нужно исправить, чтоб убрать ошибку: error LNK2019: unresolved external symbol "public: void __thiscall user::new_table(class std::vector<class table *,class std::allocator<class table *> > &)" (?new_table@user@@QAEXAAV?$vector@PAVtable@@V?$allocator@PAVtable@@@std@@@std@@@Z) referenced in function _main; Буду очень сильно благодарен, если поможете) И не закрывайте, пожалуйста, мой вопрос!