vector in header that holds one of my other Classes

I can not seem to add a vector to my head file. I have tried many things and can't figure it out.

Compile and Compile error -

g++ -Wextra -pedantic -std=c++11 Card.cpp Card.h Deck.h Deck.cpp unit_test1.cpp ;
Deck.h:15:27: error: invalid declarator before ‘deck’
void std::vector<Card *> deck;
^
In file included from Deck.cpp:4:0:
Deck.h:15:27: error: invalid declarator before ‘deck’
void std::vector<Card *> deck;
^
In file included from Deck.cpp:5:0:
Card.h:4:7: error: redefinition of ‘class Card’
class Card{
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//Deck.h
#include <iostream>
#include <vector>
#include "Card.h"

class Deck{
	public:
		//Constructor
		//Param - sets of cards needed(52 in a set).
		Deck(int numSets);
	
		//Print a deck which can consist of more than one set of cards.
		void printDeck();

	private:
	void std::vector<Card *> deck;
};
void std::vector<Card> deck;

If you do have a good reason for using pointers
1
2
//#include "Card.h"
class Card; //a forward declare is enough 
Thanks!
Topic archived. No new replies allowed.