I have be getting the following error when compiling the code as as i create a new object for my class Animal.
// here is the error i get whenh compiling the code as soon as i create the new object dog from class Animals
/*
1>template.obj : error LNK2019: unresolved external symbol "public: __thiscall Animals::~Animals(void)" (??1Animals@@QAE@XZ) referenced in function _main
1>template.obj : error LNK2019: unresolved external symbol "public: __thiscall Animals::Animals(void)" (??0Animals@@QAE@XZ) referenced in function _main
1>C:\Users\Mein PC\Desktop\AltranProject\Debug\AltranProject.exe : fatal error LNK1120: 2 unresolved externals
*/
The class ActiveParticipants is my abstract class (in header folder) and the class Animals (in header older) inherit from ActiveParticipant. but as soon as i create a new object from my main function (Template.cpp from source Files) to set some paraders i get a compiling error. any help in solving the problem would be appreciated.
#pragma once
#include <string>
using namespace std;
class ActiveParticipants
{
public:
ActiveParticipants(void);
// pure virtual functions for the interface framework
virtual int defineParticipant() = 0;
void setVolume(int v)
{
volume = v;
}
void setWeight(int w)
{
weight = w;
}
void setHeight(int h)
{
height = h;
}
void setLegs(int l)
{
legs = l;
}
void setLength(int Nlength)
{
length = Nlength;
}
void setWheels(int Nwheels)
{
wheels = Nwheels;
}
protected:
int volume;
int weight;
int height;
int length;
int wheels;
int legs;
~ActiveParticipants(void);
};
// here is a sample class Animals inheriting from the abstract class ActiveParticipants
#include "ActiveParticipants.h"
#pragma once
class Animals: public ActiveParticipants
{
public:
Animals(void);
int getParticipant()
{
return (legs, height, weight);
}
~Animals(void);
};
// here is my main function
#include "Animals.h"
#include "ActiveParticipants.h"
int main(int argc, char* argv[])
{
Animals dog; // needs to create an object of type Animals
// and sets its parameters over here
dog.setHeight(1);
dog.setLegs(4);
dog.setWeight(10);
// then print those given parameters out here
std::cout<<"Here are the parameters for the Dog:\n" <<dog.getParticipant()<<std::endl;
system("pause");
return 0;
}