My code is as follows
supportCrew.cpp
#include <iostream>
#include <sstream>
#include <fstream>
#include "compDay.h"
#include "Competion.h"
#include "Events.h"
#include "Location.h"
#include "Octathlon.h"
#include "Person.h"
#include "supportCrew.h"
#include "theTeam.h"
#include "weatherSystem.h"
supportCrew::supportCrew(sportsPsychologist newPsychologist, Physiotherapist newPhysio, trainer trainerOne, trainer trainerTwo) {
this->Psychologist = newPsychologist;
this->physio = newPhysio;
this->trainer1 = trainerOne;
this->trainer2 = trainerTwo;
}
Person.cpp
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <chrono>
#include <random>
#include <algorithm>
#include "compDay.h"
#include "Competion.h"
#include "Events.h"
#include "Location.h"
#include "Octathlon.h"
#include "Person.h"
#include "supportCrew.h"
#include "theTeam.h"
#include "weatherSystem.h"
Physiotherapist::Physiotherapist(std::string name, int age, int experience, int recovery, int readiness) : Person(name, age, experience)
{
this->readinessScore = readiness;
this->recoveryScore = recovery;
};
sportsPsychologist::sportsPsychologist(std::string name, int age, int experience, int pressure, int injury, int successFail) : Person(name, age, experience)
{
this->pressurescore = pressure;
this->injuryscore = injury;
this->successfailscore = successFail;
};
trainer::trainer(std::string name, int age, int experience, std::string specialization, int performance, int consistency) : Person(name, age, experience)
{
this->specialization = specialization;
this->performanceScore = performance;
this->consistencyScore = consistency;
};
I thought I set up my linking properly but when I compile my program I receieve the following error
supportCrew.cpp:(.text+0x25): undefined reference to `sportsPsychologist::sportsPsychologist()'
supportCrew.cpp:(.text+0x35): undefined reference to `Physiotherapist::Physiotherapist()'
supportCrew.cpp:(.text+0x45): undefined reference to `trainer::trainer()'
supportCrew.cpp:(.text+0x57): undefined reference to `trainer::trainer()'
The h files for both cpp files
supportCrew.H
#ifndef SUPPORTCREW
#define SUPPORTCREW
#include "Person.h"
class supportCrew {
public
sportsPsychologist Psychologist;
Physiotherapist physio;
trainer trainer1;
trainer trainer2;
public:
supportCrew(sportsPsychologist,Physiotherapist,trainer,trainer);
supportCrew();
};
#endif
person.h
#ifndef PERSON
#define PERSON
class Person
{
public:
std::string name;
int experience; //in years
int age;
Person(std::string pName, int pAge, int pExperience)
{
name = pName;
age = pAge;
experience = pExperience; //years of experience
};
Person();
virtual ~Person(){};
};
class Physiotherapist : public Person
{
public:
int recoveryScore;
int readinessScore;
Physiotherapist(std::string pName, int pAge, int pExperience, int recoveryScore, int readinessScore);
Physiotherapist();
};
class sportsPsychologist : public Person
{
public:
int pressurescore;
int injuryscore;
int successfailscore;
sportsPsychologist(std::string pName, int pAge, int pExperience, int pressureScore, int injuryScore, int successfailScore);
sportsPsychologist();
};
class teamManager : public Person
{
public:
teamManager(std::string pName, int pAge, int pExperience);
teamManager();
};
#endif
If anyone could let me know what part of my code is causing this error and how I can fix it it would be greatly appreciated :)