In the definition of your Card
class, a declaration for a default construction appears:
class Card
{
// ...
Card(); // <== Declaration of default constructor!
// ...
};
But no corresponding definition is given. In fact, this function definition (from card.cpp
):
void Card() {
//nothing
}
Does not define a constructor, but rather a global function called Card
that returns void
. You probably meant to write this instead:
Card::Card() {
//nothing
}
Unless you do that, since the default constructor is declared but not defined, the linker will produce error about undefined references when a call to the default constructor is found.
The same applies to your constructor accepting two arguments. This:
void Card(Card::Rank rank, Card::Suit suit) {
cardRank = rank;
cardSuit = suit;
}
Should be rewritten into this:
Card::Card(Card::Rank rank, Card::Suit suit) {
cardRank = rank;
cardSuit = suit;
}
And the same also applies for other member functions: it seems you did not add the Card::
qualifier before the member function names in their definitions. Without it, those functions are global functions rather than definitions of member functions.
Your destructor, on the other hand, is declared but never defined. Just provide a definition for it in card.cpp
:
Card::~Card() { }