Я пытаюсь запустить свой код получения номера оценки, чтобы изменить его на символ, но я получаю ошибку LNK 2019, хотя я думаю, что я ничего не пропускаю неправильно опубликует мой код и ошибку, так как я не могу найти проблему, любая помощь будет большой благодарностью. Это main.cpp
#include <iostream>
#include <string>
#include <typeinfo>
#include "Grades.h"
#include "Letter.h"
using namespace sict;
int main(int argc, char* argv[]) {
std::ofstream ofs("Lab5Output.txt");
std::cout << "Command Line : ";
for (int i = 0; i < argc; i++) {
std::cout << argv[i] << ' ';
}
std::cout << std::endl;
if (argc == 1) {
std::cerr << "\n*** Insufficient number of arguments ***\n";
std::cerr << "Usage: " << argv[0] << " fileName \n";
return 1;
}
else if (argc != 2) {
std::cerr << "\n*** Too many arguments ***\n";
std::cerr << "Usage: " << argv[0] << " fileName \n";
return 2;
}
try
{
sict::Grades grades(argv[1]);
auto letter = [](double grade)
{
int grd;
if ((grade >= 90) && (grade <= 100)) {
grd = Aplus;
}
else if ((grade >= 80) && (grade < 90)) {
grd = A;
}
else if ((grade >= 75) && (grade < 80)) {
grd = Bplus;
}
else if ((grade >= 70) && (grade < 75)) {
grd = B;
}
else if ((grade >= 65) && (grade < 70)) {
grd = Cplus;
}
else if ((grade >= 60) && (grade < 65)) {
grd = C;
}
else if ((grade >= 55) && (grade < 60)) {
grd = Dplus;
}
else if ((grade >= 50) && (grade < 55)) {
grd = D;
}
else {
grd = F;
}
return grd;
};
grades.displayGrades(std::cout, letter);
}
catch (const char * err)
{
throw err;
return 1;
}
return 0;
ofs.close();
}
это grades.cpp
#include <fstream>
#include <iostream>
#include "Letter.h"
#include "Grades.h"
using namespace std;
namespace sict {
Grades::Grades(const char* data ) {
if (data != nullptr && data[0] != '\0') {
int i = 0;
int j = 0;
int sn;
double grade;
string getMarks;
ifstream fs(data);
while (getline(fs, getMarks)) {
i++;
}
lines = i;
this->studentnum = new int[lines];
this->gradenum = new double[lines];
fs.close();
fs.open(data);
while (getline(fs, getMarks)){
while (fs >> sn >> grade)
{
this->studentnum[i] = sn;
this->gradenum[i] = grade;
i++;
}
}
}
}
template <typename T>
void Grades::displayGrades(std::ostream& os, T letter) const {
for (int i = 0; i < lines; i++){
int grade = lambda(gradenum);
string letter = convert(grade);
os << studentnum[i] << " " <<gradesnum[i] << " " << letter(gradenum[i])<< std::endl;
}
}
}
это сорт.ч
#ifndef SICT_GRADES_H
#define SICT_GRADES_H
#include <fstream>
#include <iostream>
#include "Letter.h"
namespace sict {
class Grades {
int* studentnum;
double* gradenum;
char gradeletter;
size_t lines;
public:
Grades(const Grades&) = delete;
Grades(Grades&&) = delete;
Grades& operator=(const Grades&) = delete;
Grades&& operator=(Grades&&) = delete;
Grades(const char*);
template <typename T>
void displayGrades(std::ostream&, T) const;
~Grades() { delete [] studentnum; delete [] gradenum; };
};
}
#endif // !SICT_GRADES_H
и вот это буква. Ч
#ifndef SICT_LETTER_H
#define SICT_LETTER_H
#include <string>
#include "Grades.h"
using namespace std;
namespace sict {
enum marks {
F, D, Dplus, C, Cplus, B, Bplus, A, Aplus
};
template <typename T>
string convert(T& mark) {
string grade = "";
if (mark = marks::F){
grade = "F";
}
else if (mark = marks::D) {
grade = "D";
}
else if (mark = marks::Dplus) {
grade = "D+";
}
else if (mark = marks::C) {
grade = "C";
}
else if (mark = marks::Cplus) {
grade = "C+";
}
else if (mark = marks::B) {
grade = "B";
}
else if (mark = marks::Bplus) {
grade = "B+";
}
else if (mark = marks::A) {
grade = "A";
}
else if (mark = marks::Aplus) {
grade = "A+";
}
return grade;
}
}
#endif // !SICT_GRADES_H
но я получаю эту ошибку
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "public: void __thiscall
sict::Grades::displayGrades<class <lambda_6686105985789fb8252d1ceed5cbf23c>
>(class std::basic_ostream<char,struct std::char_traits<char> > &,class
<lambda_6686105985789fb8252d1ceed5cbf23c>)const " (?? $displayGrades@V<lambda_6686105985789fb8252d1ceed5cbf23c>@@@Grades@sict@@QBEXAA V?$basic_ostream@DU?$char_traits@D@std@@@std@@V<lambda_6686105985789fb8252d1ceed5cbf23c>@@@Z)
referenced in function _main Lambda Experssion C:\Users\Albert\Documents\Lambda Experssion\W5.obj 1
любая помощь будет принята с благодарностью, спасибо