I have three files - Main.cpp
, Functions.cpp
and Header.h
. I have declared a class in Header.h
.
#pragma once
class CStack
{
private:
int* topCardType;
int* topCardValue;
int cardType[52];
int cardValue[52];
int size;
public:
CStack* CreateDeck();
};
I have defined the function CreateDeck()
in Functions.cpp
#include "Header.h"
CStack* CStack::CreateDeck() {}
However when I call it in Main.cpp I'm getting Error: identifier CreateDeck is undefined
#include "Header.h"
int main()
{
CStack* deck = CreateDeck(); //creates deck of 52 cards
}
Please help. I'm new to C++. This used to work when I use structure instead of classes in C