I try to write somthing from my class to a file bu it has this error
C:\Users\Lenovo\AppData\Local\Temp\ccaLsCIe.o:main.cpp:(.text+0xe7): undefined reference to `CoronaVaccine::CoronaVaccine(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, int, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)' collect2.exe: error: ld returned 1 exit status
and this is my code
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
class CoronaVaccine{
string name;
string nationalID;
int dose = 0;
string nextDate;
public:
CoronaVaccine (string="", string="",int=0,string="");
void setName(string a){
name = a;
}
string getName() const{
return name;
}
void setNatinalID(string b){
nationalID = b;
}
string getNtinalID() const{
return nationalID;
}
void setDoseDate(int c, string d){
dose = c;
if (dose == 1){
nextDate = d;
}else{
nextDate = "Done";
}
}
int getDose() const{
return dose;
}
string getNextDte() const{
return nextDate;
}
};
int main(){
char cont;
string nameMain;
string natinalIdMain;
int doseMain;
string nextDateMain;
CoronaVaccine client;
ofstream fp("coronaVaccine.txt");
if (!fp){
cout << "something goes wrong!";
exit(0);
}
while (1)
{
cout << "Name natinalID dose date: \n";
cin >> nameMain;
cin >> natinalIdMain;
cin >> doseMain;
cin >> nextDateMain;
client.setName(nameMain);
client.setNatinalID(natinalIdMain);
client.setDoseDate(doseMain,nextDateMain);
cout << "do you want to countinue(y/n): ";
cin >> cont;
if (cont == 'n'){
break;
}
fp.write((char *) &client,sizeof(CoronaVaccine));
}
cout << "\n==============================\n";
fp.close();
return 0;
}