Including a Header file, does not compile

I have my code all set and ready to go but whenever I try to compile, it gives me some errors. I am using Dev C++ since Visual Studio gave me a hard time because of a linker issue

Here are the errors.

C:\Users\johndoe\Documents\Untitled2.cpp In file included from C:\Users\johndoe\Documents\Untitled2.cpp

C:\Users\johndoe\Documents\carddeck.h [Error] expected ';' after class definition

Here is a link to the Cpp and header files that I am using

https://www.dropbox.com/s/s6u6yxn7kzmv2w0/DiceMenu_wCards_vOOD.cpp?dl=0
https://www.dropbox.com/s/2dsejxyiu3ryeve/carddeckimplementation.cpp?dl=0
https://www.dropbox.com/s/03p6rn8du7rpyks/carddeck.h?dl=0

I'd appreciate any help
you are missing a ;
in carddeck.h

If you want us to look at the code, post your code with code tags.
I tried putting it in the body paragraph but it's a huge code and it exceeded the max number of characters. and I tried it and it gave me another error

C:\Users\johndoe\Documents\Untitled2.cpp In file included from C:\Users\johndoe\Documents\Untitled2.cpp

C:\Users\johndoe\Documents\carddeck.h [Error] expected ';' after class definition
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class carddeck
{
private:
	const int DECKSIZE;
	int cardDeck[52];

public:
	carddeck();

	void displayCard(int card);

	int getCardValue(int card);

	void shuffleCards();

	int dealCard();
};


This is my header file
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class carddeck
{
private:
	const int DECKSIZE;
	int cardDeck[52];

public:
	carddeck();

	void displayCard(int card);

	int getCardValue(int card);

	void shuffleCards();

	int dealCard();
};

This is my header file

Sorry, it isn't.
In the version you uploaded on Dropbox the last semicolon is missing:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class carddeck
{
private:
	const int DECKSIZE;
	int cardDeck[52];

public:
	carddeck();

	void displayCard(int card);

	int getCardValue(int card);

	void shuffleCards();

	int dealCard();
} // <-- a semicolon is missing here 

The compiler also complains for other errors and warnings:
In file included from carddeckimplementation.cpp:2:0:
carddeck.h:17:2: error: expected ';' after class definition
 }
  ^
  ;
carddeckimplementation.cpp: In constructor 'carddeck::carddeck()':
carddeckimplementation.cpp:7:1: error: uninitialized const member in 'const int' [-fpermissive]
 carddeck::carddeck()
 ^~~~~~~~
In file included from carddeckimplementation.cpp:2:0:
carddeck.h:4:12: note: 'const int carddeck::DECKSIZE' should be initialized
  const int DECKSIZE;
            ^~~~~~~~
carddeckimplementation.cpp: In member function 'void carddeck::displayCard(int)':
carddeckimplementation.cpp:71:2: error: expected ';' before '}' token
  } //end switch
  ^
In file included from DiceMenu_wCards_vOOD.cpp:6:0:
carddeck.h:17:2: error: expected ';' after class definition
 }
  ^
  ;
DiceMenu_wCards_vOOD.cpp: In function 'void cardDeck()':
DiceMenu_wCards_vOOD.cpp:244:6: warning: unused variable 'value' [-Wunused-variable]
  int value;
      ^~~~~
DiceMenu_wCards_vOOD.cpp: In function 'void twentyone()':
DiceMenu_wCards_vOOD.cpp:593:5: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
  if (winner == "")
     ^
DiceMenu_wCards_vOOD.cpp: In function 'void twentyone_V2()':
DiceMenu_wCards_vOOD.cpp:763:5: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
  if (winner == "")
     ^
DiceMenu_wCards_vOOD.cpp:608:55: warning: unused variable 'mydeck' [-Wunused-variable]
  int playerOneHand[HANDSIZE], computerHand[HANDSIZE], mydeck[DECKSIZE] = { -5 };
                                                       ^~~~~~
Topic archived. No new replies allowed.