Unresolved Externals, Unresolved external symbol LNK 1120 - c++

I am making a bank account program and can not figure out why I keep getting the following error:
Error 5 error LNK1120: 1 unresolved externals
I have a superclass BankAccount and a child class Checking Account.
Bank Account .h:
#pragma once
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class BankAccount
{
public:
BankAccount::BankAccount();
BankAccount::~BankAccount();
virtual void depsoit(double money) = 0;
virtual double withdraw(double money) = 0;
virtual double getBalance() = 0;
virtual void endOfMonth() = 0;
private:
double balance;
};
Bank account .cpp
#include "BankAccount.h"
#include <iostream>
#include <vector>
using namespace std;
BankAccount::BankAccount()
{
balance = 0;
}
BankAccount::~BankAccount()
{
}
CheckingAccount.h
#pragma once
#include "BankAccount.h"
#include <vector>
#include <iostream>
using namespace std;
class CheckingAccount :
public BankAccount
{
public:
CheckingAccount();
~CheckingAccount();
void depsoit(double money);
double withdraw(double request);
double getBalance();
void endOfMonth();
private:
double checkingBalance=0;
int transactionLimit = 5;
float fee = .05;
double fees=0;
vector <double> feeTransactions;
};
CheckingAccount.cpp
#include "CheckingAccount.h"
#include <iostream>
#include <vector>
using namespace std;
CheckingAccount::CheckingAccount()
{
checkingBalance = 0;
}
CheckingAccount::~CheckingAccount()
{
}
void CheckingAccount::depsoit(double money)
{
if (transactionLimit > 0)
{
transactionLimit--;
cout << "You have " << transactionLimit << " transactions left";
checkingBalance += money;
}
else
{
feeTransactions.push_back(money);
cout << "Your transaction went through but you incurred a fee";
checkingBalance += money;
}
}
double CheckingAccount::withdraw(double request)
{
if (checkingBalance < request)
{
cout << "Sorry you do not have the available funds";
return 0.0;
}
else if (transactionLimit > 0)
{
transactionLimit--;
cout << "You have " << transactionLimit << " transactions left";
checkingBalance -= request;
return request;
}
else
{
feeTransactions.push_back(request);
cout << "Your transaction went through but you incurred a fee";
checkingBalance -= request;
return request;
}
}
double CheckingAccount::getBalance()
{
return checkingBalance;
}
void CheckingAccount::endOfMonth()
{
for (int i = 0; i < feeTransactions.size(); i++)
{
fees = feeTransactions[i] * fee;
}
checkingBalance -= fees;
}
And finally MAIN.CPP
#include "CheckingAccount.h"
#include <iostream>
#include <vector>
using namespace std;
int main()
{
CheckingAccount test();
test().getBalance();
//system("PAUSE");
return 1;
}
The error message again is:
Error 4 error LNK2019: unresolved external symbol "class
CheckingAccount __cdecl test(void)" (?test##YA?AVCheckingAccount##XZ)
referenced in function _main C:...Main.obj Assignment1Part3A

You are not declaring a variable of type CheckingAccount here:
CheckingAccount test();
What you are doing is declaring a function test which returns an object of type CheckingAccount and takes in no parameters.
Do it as follows:
CheckingAccount test{};
You should call getBalance as follows:
test.getBalance(); and not test().getBalance();

Well the error tells you exactly what's the problem. It's in your main: test().getBalance();. You are calling test as it was a function, but it's an object name. It should be just test.getBalance(). The previous line should be without the () too, but they should be fine there, because the compiler is treating them as a constructor in that case.

Related

C++ clang linker command failed with exit code 1 [duplicate]

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 4 years ago.
My professor gave me two class header and .cpp files to build on. When I include these in main, they work fine. Whenever I just use his files, I get linker errors with clang and xcode.
Here's the error:
shannigan#mbp-007100 inheritance (master) $ make main
c++ main.cpp -o main
Undefined symbols for architecture x86_64:
"SavitchEmployees::SalariedEmployee::SalariedEmployee()", referenced from:
_main in main-0d7e27.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [main] Error 1
Here's my main:
#include "employee.h"
#include "salariedemployee.h"
#include <string>
#include <cstdlib>
#include <iostream>
using namespace SavitchEmployees;
using namespace std;
int main() {
cout << "Do I run?" << endl;
SalariedEmployee sam;
return 0;
};
The header file for Employee:
//This is the header file employee.h.
//This is the interface for the class Employee.
//This is primarily intended to be used as a base class to derive
//classes for different kinds of employees.
#ifndef EMPLOYEE_H
#define EMPLOYEE_H
#include <string>
using std::string;
namespace SavitchEmployees
{
class Employee
{
public:
Employee( );
Employee(const string& theName, const string& theSsn);
string getName( ) const;
string getSsn( ) const;
double getNetPay( ) const;
void setName(const string& newName);
void setSsn(const string& newSsn);
void setNetPay(double newNetPay);
void printCheck( ) const;
protected:
string name;
string ssn;
double netPay;
};
}//SavitchEmployees
#endif //EMPLOYEE_H
The CPP file for main:
//This is the file: employee.cpp
//This is the implementation for the class Employee.
//The interface for the class Employee is in the header file employee.h.
#include <string>
#include <cstdlib>
#include <iostream>
#include "employee.h"
using std::string;
using std::cout;
namespace SavitchEmployees
{
Employee::Employee( ) : name("No name yet"), ssn("No number yet"), netPay(0)
{
//deliberately empty
}
Employee::Employee(const string& theName, const string& theNumber)
: name(theName), ssn(theNumber), netPay(0)
{
//deliberately empty
}
string Employee::getName( ) const
{
return name;
}
string Employee::getSsn( ) const
{
return ssn;
}
double Employee::getNetPay( ) const
{
return netPay;
}
void Employee::setName(const string& newName)
{
name = newName;
}
void Employee::setSsn(const string& newSsn)
{
ssn = newSsn;
}
void Employee::setNetPay (double newNetPay)
{
netPay = newNetPay;
}
void Employee::printCheck( ) const
{
cout << "\nERROR: printCheck FUNCTION CALLED FOR AN \n"
<< "UNDIFFERENTIATED EMPLOYEE. Aborting the program.\n"
<< "Check with the author of the program about this bug.\n";
exit(1);
}
}//SavitchEmployees
SalariedEmployees header:
//This is the header file salariedemployee.h.
//This is the interface for the class SalariedEmployee.
#ifndef SALARIEDEMPLOYEE_H
#define SALARIEDEMPLOYEE_H
#include <string>
#include "employee.h"
using std::string;
namespace SavitchEmployees
{
class SalariedEmployee : public Employee
{
protected:
double salary;//weekly
public:
SalariedEmployee( );
SalariedEmployee (const string& theName, const string& theSsn,
double theWeeklySalary);
double getSalary( ) const;
void setSalary(double newSalary);
void printCheck( );
};
}//SavitchEmployees
#endif //SALARIEDEMPLOYEE_H
SalariedEmployee.cpp:
//This is the file salariedemployee.cpp
//This is the implementation for the class SalariedEmployee.
//The interface for the class SalariedEmployee is in
//the header file salariedemployee.h.
#include <iostream>
#include <string>
#include "salariedemployee.h"
using std::string;
using std::cout;
using std::endl;
namespace SavitchEmployees
{
SalariedEmployee::SalariedEmployee( ) : Employee( ), salary(0)
{
//deliberately empty
}
SalariedEmployee::SalariedEmployee(const string& newName, const string& newNumber,
double newWeeklyPay)
: Employee(newName, newNumber), salary(newWeeklyPay)
{
//deliberately empty
}
double SalariedEmployee::getSalary( ) const
{
return salary;
}
void SalariedEmployee::setSalary(double newSalary)
{
salary = newSalary;
}
void SalariedEmployee::printCheck( )
{
setNetPay(salary);
cout << "\n__________________________________________________\n";
cout << "Pay to the order of " << getName( ) << endl;
cout << "The sum of " << getNetPay( ) << " Dollars\n";
cout << "_________________________________________________\n";
cout << "Check Stub NOT NEGOTIABLE \n";
cout << "Employee Number: " << getSsn( ) << endl;
cout << "Salaried Employee. Regular Pay: "
<< salary << endl;
cout << "_________________________________________________\n";
}
}//SavitchEmployees
How can I get rid of these linker errors so I can focus on my actual code? Is there anything obvious wrong? The only thing I've changed was making the "private" variables protected.
I can't see the class named SalariedEmployee.
I think the main function should look like this.
int main() {
cout << "Do I run?" << endl;
Employee sam;
return 0;
};
You have to use Employee instead of SalariedEmployee

derived class giving error when accessing private variables of base class

I am making a c++ program to store employee's data like name, id, saleamount, commission amount and calculate earning (sales*commission). I am using the concept of inheritance. My base class is 'Employee' and my derived class is 'SeniorEmployee'. When I run the program, the compiler gives me an error that I cannot access the private members of base class. The errors are like this
error: 'std::__cxx11::string Employee::name' is private.
Another error on 2nd line is
error: 'int Employee::id' is private
Again the same error on 3rd line
error: 'double Employee::sales' is private
Following is my code. I have included all files.
File Employee.h
#ifndef EMPLOYEE_H_
#define EMPLOYEE_H_
#include <iostream>
#include <string>
using namespace std;
class Employee {
public:
Employee(string EmpName, int EmpID, double EmpSales, double EmpComm);
void setName(string EmpName);
string getName();
void setID(int EmpID);
int getID();
void setSales(double EmpSales);
double getSales();
void setComm(double EmpComm);
double getComm();
double earning();
private:
string name;
int id;
double sales;
double commission;
};
#endif
File Employee.cpp
#include <iostream>
#include <string>
#include "Employee.h"
using namespace std;
Employee::Employee(string EmpName, int EmpID, double EmpSales, double EmpComm): name(EmpName), id(EmpID), sales(EmpSales), commission(EmpComm)
{
}
void Employee::setName(string EmpName) {
name=EmpName;
}
string Employee::getName() {
return name;
}
void Employee::setID(int EmpID) {
id=EmpID;
}
int Employee::getID() {
return id;
}
void Employee::setSales(double EmpSales) {
sales=EmpSales;
}
double Employee::getSales() {
return sales;
}
void Employee::setComm(double EmpComm) {
commission=EmpComm;
}
double Employee::getComm() {
return commission;
}
double Employee::earning() {
return sales*commission;
}
File SeniorEmployee.h
#ifndef SENIOREMPLOYEE_H_
#define SENIOREMPLOYEE_H_
#include "Employee.h"
#include <iostream>
#include <string>
using namespace std;
class SeniorEmployee: public Employee {
public:
SeniorEmployee(string EmpName, int EmpID, double EmpSales, double EmpComm, double BaseSalary);
void setBaseSalary(double BaseSalary);
double getBaseSalary();
private:
double bsalary;
};
#endif
File SeniorEmployee.cpp
#include <iostream>
#include <string>
#include "SeniorEmployee.h"
using namespace std;
SeniorEmployee::SeniorEmployee(string EmpName, int EmpID, double EmpSales, double EmpComm, double BaseSalary) : Employee(name,id,sales,commission)
{
}
void SeniorEmployee::setBaseSalary(double BaseSalary) {
bsalary=BaseSalary;
}
double SeniorEmployee::getBaseSalary() {
return bsalary;
}
File main.cpp
#include <iostream>
#include "SeniorEmployee.h"
using namespace std;
int main() {
string empname = "Fareed Shuja";
int empid = 3978;
double empsales = 30.0;
double empcomm = 0.99;
double basesalary = 50.0;
SeniorEmployee emp(empname,empid,empsales,empcomm,basesalary);
cout << "Name of the Employee is : " << emp.getName() << endl;
cout << "Employee ID is : " << emp.getID() << endl;
cout << "Sale Amount is : " << emp.getSales() << endl;
cout << "Commission is : " << emp.getComm() << endl;
cout << "Earning is : " << emp.earning() << endl;
cout << "Employee's base salary is " << emp.getBaseSalary() << endl;
return 0;
}
The following line in SeniorEmployee.cpp is incorrect:
SeniorEmployee::SeniorEmployee(string EmpName, int EmpID, double EmpSales, double EmpComm, double BaseSalary) : Employee(name,id,sales,commission)
It's attempting to access the private variables 'name', 'id', etc... instead of passing your constructor's arguments to the base class constructor. It should instead be:
SeniorEmployee::SeniorEmployee(string EmpName, int EmpID, double EmpSales, double EmpComm, double BaseSalary) : Employee(EmpName,EmpID,EmpSales,EmpComm)
Also if you want to access variables from a derived class but not make them visible outside of the class they must be declared protected instead of private.

C++ lnk2019 and lnk 2020 yes it's in the right format

Here's my code and the errors I'm receiving - any help would be appreciated.
There's something wrong with getNextAcountNumber. I have tried to assign the value of account ID but it has not worked since it is a private member.
Error 1 error LNK2019: unresolved external symbol "private: int __thiscall Account::getNextAccountNumber(void)const " (?getNextAccountNumber#Account##ABEHXZ) referenced in function "public: __thiscall Account::Account(class std::basic_string,class std::allocator >,double)" (??0Account##QAE#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##N#Z) H:\programming\AccountClass\AccountClass.obj AccountClass
H:\programming\AccountClass\Debug\AccountClass.exe : fatal error LNK1120: 1 unresolved externals
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>
#include "Account.h"
using namespace std;
int main()
{
Account acct01;
Account acct02("Harold M. Ferguson", 2000);
Account acct03("Elise Janet Simmons", 3500);
Account acct04("James Holder", 0);
cout << endl << "Account information - initial" << endl;
acct01.displayAccountInfo(); // show account information - initial values
acct02.displayAccountInfo();
acct03.displayAccountInfo();
acct04.displayAccountInfo();
acct01.setAccountHolder("Mary A. Tarleton");
acct01.setBalance(542.39);
acct04.setAccountHolder("James Ellis Holder");
acct04.setBalance(1990.75);
cout << endl << "Account information after changes" << endl;
acct01.displayAccountInfo(); // show account information after changes
acct02.displayAccountInfo();
acct03.displayAccountInfo();
acct04.displayAccountInfo();
acct01.depositAmount(455); // make deposits
acct02.depositAmount(-19.95); // negative deposit not allowed - set to zero
acct03.depositAmount(4365.27);
acct04.depositAmount(95.63);
cout << endl << "Account information after deposits" << endl;
acct01.displayAccountInfo(); // show account information after deposits
acct02.displayAccountInfo();
acct03.displayAccountInfo();
acct04.displayAccountInfo();
acct01.withdrawAmount(37.39);
acct02.withdrawAmount(-475.25); // withdrawal may be positive or negative (absolute value)
acct03.withdrawAmount(0.25);
acct04.withdrawAmount(50.00);
cout << endl << "Account information after withdrawals" << endl;
acct01.displayAccountInfo(); // show account information after withdrawals
acct02.displayAccountInfo();
acct03.displayAccountInfo();
acct04.displayAccountInfo();
cout << endl;
system("pause");
return 0;
}
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include "Account.h"
#include <string>
using namespace std;
Account::Account()
{
accountID = getNextAccountNumber();
accountHolder = "no name";
balance = 0;
}
Account::Account(string name, double amount)
{
accountID = getNextAccountNumber();
accountHolder = name;
balance = amount;
}
int Account::getAccountID() const
{
return accountID;
}
string Account::getAccountHolder() const
{
return accountHolder;
}
double Account::getBalance() const
{
return balance;
}
void Account::setAccountHolder(string name)
{
accountHolder = name;
}
void Account::setBalance(double amt)
{
amt = balance;
}
void Account::depositAmount(double amt)
{
if (amt > 0)
{
balance = +amt;
}
else;
{
balance = balance;
}
}
void Account::withdrawAmount(double amt)
{
balance = balance - amt;
}
void Account::displayAccountInfo() const
{
cout << accountID << accountHolder << balance;
}
#ifndef ACCOUNT_H
#define ACCOUNT_H
#include <string>
using namespace std;
static int accountNumber = 100000; // starting value for account#
class Account
{
public:
Account(); // default constructor
Account(string name, double amount); // constructor with two parameters
int getAccountID() const; // ACCESSOR member functions
string getAccountHolder() const; // return name of account holder
double getBalance() const; // return account balance
void setAccountHolder(string name); // MUTATOR member functions
void setBalance(double amt); // assign amount to balance
void depositAmount(double amt); // add amount to balance
void withdrawAmount(double amt); // subtract absolute value of amount from balance
// HELPER member functions
void displayAccountInfo() const; // display account information
private:
int getNextAccountNumber() const; // get next account# (pre-increment account number)
// private DATA members
int accountID; // account# identifier
string accountHolder; // name of account holder
double balance; // account balance
};
// accountID = ++accountNumber
#endif
This problem is not related to the function being private - it is being called by the constructor(s), which have access to the private members of the class.
Both #DrewDormann and #PaulMcKenzie seem correct in the comments - you have (at least listed) no implementation for Account::getNextAccountNumber()
This should likely be in the second code snippet you have posted (likely Account.cpp, or similar)
Consider adding something like
int Account::getNextAccountNumber()
{
return accountNumber++;
}
However, this would seem in nature to be a function independent of anything even remotely related to any individual given Account, so consider making it a freestanding function. (i.e. not a member of the Account class)
Then you'd just have
int getNextAccountNumber()
{
return accountNumber++;
}
but in that case, you'd have to modify the header (perhaps Account.h?) to remove the member function. Otherwise, you'll still get the linker error you're currently hitting.
Edit: The function is declared as const, so you need the const specifier.
int Account::getNextAccountNumber() const
{
return accountNumber++;
}

Unresolved external issue when compiling multi-source files

I have a project that consists of 2 CPP files (main.cpp and Car.cpp) and a header file (Car.h). The program is meant to allow a user to enter the model, make, and speed of a car and displays the modified speed. My issue is that when I compile the project, I receive a "1 unresolved externals" issue like so:
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall Car::Car(void)" (??0Car##QAE#XZ) referenced in function _main
1>C:\Users\Shaidi\Desktop\Classes\CIST 2362\Projects\main\Debug\main.exe : fatal error LNK1120: 1 unresolved externals
Here is the main.cpp file:
// main.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "Car.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
string make;
int model, speed;
Car c;
//user input and assignment for make, model, and speed
cout << "Enter the make of the car: " <<endl;
cin >> make;
c.setMake(make);
cout << "Enter the model of the car: " <<endl;
cin >> model;
c.setYearModel(model);
cout << "Enter the speed of the car: " <<endl;
cin >> speed;
c.setSpeed(speed);
//print make and model
cout << "Car make: " << c.getMake() <<endl;
cout << "Car model: " << c.getYearModel() << endl;
cout << "Car speed: " << c.getSpeed() <<endl;
//loops to calculate and print acceleration and braking
for (int i = 0; i < 5; i ++){
cout << "Car speed after acceleration: " <<c.accelerate() <<endl;
}
for (int i = 0; i < 5; i ++){
cout << "Car speed after braking: " <<c.brake() <<endl;
}
return 0;
} //end main
Here is the Car.cpp file:
// Car.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "Car.h"
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;
Car::Car(int y, string m)
{
string make = m;
int year = y;
speed = 0;
}
void Car::setYearModel(int y)
{
yearModel = y;
}
void Car::setSpeed(int s)
{
if (s >= 0){
speed = s;
} else {
cout << "Invalid speed";
exit(EXIT_FAILURE);
}
}
void Car::setMake(string m)
{
make = m;
}
int Car::getYearModel()
{
return yearModel;
}
int Car::getSpeed()
{
return speed;
}
string Car::getMake()
{
return make;
}
int Car::accelerate()
{
return speed + 5;
}
int Car::brake()
{
return speed - 5;
}
And here is the Car.h file:
#ifndef CAR_H
#define CAR_H
#include <string>
using namespace std;
class Car
{
private:
std::string make;
int yearModel;
int speed;
public:
Car();
Car(int, std::string);
void setYearModel(int);
void setSpeed(int);
void setMake(std::string);
int getYearModel() ;
int getSpeed() ;
int accelerate() ;
int brake() ;
std::string getMake() ;
};
#endif // CAR_H
You miss the implementation of default constructor of Car().
class Car
{
public:
// There is no implementation.
Car();
}
You've declared Car::Car() but never defined it. Either add a definition to the .cpp file, or remove the declaration from the header.
For example:
Car::Car()
{
}
It looks like you have defined the default constructor for car but have not implemented it. Then you declared a variable of type car which would require it to be implemented. Adding the code that Kerrek has above to the .cpp file should do the trick :)

Getting Error LNK2019 due to creating a vector array from structure header?

I'm am attempting to create a vector of arrays from inputting files and then loading the vector into my main. I am also attempting to use the same vector throughout my program. When I compile, however, I get a bunch of Error LNK2019s. I think I have an idea as to where this is happening but I am unsure as to why. Could someone help or explain? Thanks!
#include <iostream>
#include <string>
#include <vector>
#include "Database.h"
#include "Registration.h"
#include "Competition.h"
#include "Events.h"
#include "CompPop.h"
#include "PushRegistration.h"
using namespace std;
void main()
{
vector<Competition> myVector = CompPop();
vector<Registration> myRegistration = PushRegistration();
Database home(myVector, myRegistration);
home.Menu();
system("pause");
}
Seems to occur at:
1. vector < Competition > myVector
2. vector< Registration> myRegistration
and these are the error messages I am getting
error LNK2001: unresolved external symbol "public: __thiscall Registration::~Registration(void)" (??1Registration##QAE#XZ)
and
error LNK2001: unresolved external symbol "public: __thiscall Database::~Database(void)" (??1Database##QAE#XZ)
My Compop header, reads from a file and stores the contents into a vector of Competition (similar to my PushRegistration header)
#pragma once
#include <fstream>
#include <sstream>
#include <iostream>
#include <string>
#include <vector>
#include "LogIn.h"
#include "Registration.h"
#include "Events.h"
#include "Competition.h"
using namespace std;
vector<Competition> CompPop()
{
ifstream myfile("PSU Results.txt");
string line, tcomp, tleader, tfollower, tevents, tplacement;
vector<Competition> info;
if(myfile.is_open())
{
int i = 0; // finds first line
int n = 0; // current vector index
int space;
while(!myfile.eof())
{
getline(myfile,line);
if(line[i] == '*')
{
space = line.find_first_of(" ");
tleader = line.substr(0+1, space);
tfollower = line.substr(space + 1, line.size());
}
else
{
if(line[i] == '-')
{
tcomp = line.substr(1, line.size());
Competition temp(tcomp, tleader, tfollower);
info[n] = temp;
}
else
{
if(!line.empty())
{
line = line;
space = line.find_first_of(",");
tevents = line.substr(0, space);
tplacement = line.substr(space + 2, line.size());
info[n].pushEvents(tevents,tplacement);
}
if(line.empty())
{
n++;
}
}
}
}
}
else
{
cout << "Unable to open file";
}
myfile.close();
return info;
}
My Competition Header (Similar to my Registration header):
#pragma once
#include <fstream>
#include <sstream>
#include <iostream>
#include <string>
#include <vector>
#include "LogIn.h"
#include "Registration.h"
#include "Events.h"
using namespace std;
struct Competition
{
public:
Competition(string compName, string lead, string follow)
{
Name = compName;
Leader = lead;
Follower = follow;
}
void pushEvents(string name, string place)
{
Events one(name, place);
Eventrandom.push_back(one);
}
string GetName()
{
return Name;
}
string GetLeader()
{
return Leader;
}
string GetFollow()
{
return Follower;
}
string GetEvent()
{
return Event;
}
string GetScore()
{
return Score;
}
void Print()
{
cout << "Leader: " << Leader << endl;
cout << "Follower: " << Follower << endl;
cout << "Competition: " << Name << endl;
cout << "Events and Placement: " << endl;
for(vector<Events>::iterator pos = Eventrandom.begin(); pos != Eventrandom.end(); ++pos)
{
cout << pos->eventName << " " << pos->Placement << endl;
}
cout << endl;
}
~Competition();
private:
string Name, Leader, Follower, Event, Score;
vector<Events> Eventrandom;
};
My Registration header:
#pragma once
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
#define MAX_LENGTH 7
#define MAX_DANCES 9
class Registration
{
public:
Registration();
Registration(string confirmationCode, string follower, string leader, string comp, string level, string dance);
void FirstTime();
void infoFollower();
void infoLeader();
string gen_random(const int len);
string Levels();
string Dances();
void Print();
void print2Confirmation();
~Registration();
private:
string CCode, Follower, Leader, Name;
string Level, Dance;
};
The error messages are pretty clear.
unresolved external symbol "public: __thiscall
Registration::~Registration(void)"
Registration::~Registration(void) is the destructor of the Registration class. Have you defined one?