Possible Duplicate:
What is an undefined reference/unresolved external symbol error and how do I fix it?
I have a problem with the Linker which I just can't solve.. Already tried anything I could think of I have a Baseclass (Person) and a Derived Class (Dealer) and I just want to call the Constructor from the CardStack Class which is a member in the Dealer class.
Here is my code:
Person.h
#ifndef PERSON_H
#define PERSON_H
#include "Card.h"
#include "Hand.h"
class Person
{
public:
Person(void);
virtual ~Person(void);
virtual bool TakeCard(Card c);
virtual bool Lost(void);
protected:
virtual void CheckLost(void);
bool b_Lost;
Hand m_Hand;
};
#endif
Dealer.h
#ifndef DEALER_H
#define DEALER_H
#include "Person.h"
#include "Card.h"
#include "CardStack.h"
class Dealer : public Person
{
public:
Dealer(int stackcount);
virtual ~Dealer(void);
bool TakeCard(Card c);
bool Lost(void);
Card GiveCard(Card c);
protected:
void CheckLost(void);
CardStack m_GameStack;
};
#endif
Dealer.cpp
#include "Dealer.h"
Dealer::Dealer(int stackcount) : Person(), m_GameStack(stackcount)
{
};
Dealer::~Dealer(void)
{
};
bool Dealer::TakeCard(Card c)
{
if(!b_Lost || m_Hand.GetTotal() <= 17)
{
m_Hand.Take(c);
CheckLost();
return true;
}
return false;
};
void Dealer::CheckLost()
{
if (m_Hand.GetTotal() > 21)
{
b_Lost = true;
}
};
bool Dealer::Lost()
{
return b_Lost;
};
I honestly tried everthing I could think of but I couldn't figure out what the mistake is...
Here is the Output when compiling Dealer.cpp:
1>Dealer.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Person::~Person(void)" (??1Person@@UAE@XZ) referenced in function __unwindfunclet$??0Dealer@@QAE@H@Z$0
1>Dealer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall Person::TakeCard(class Card)" (?TakeCard@Person@@UAE_NVCard@@@Z)
1>Dealer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall Person::Lost(void)" (?Lost@Person@@UAE_NXZ)
1>Dealer.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall Person::CheckLost(void)" (?CheckLost@Person@@MAEXXZ)