error c2011 class type redefinition

I am new to the concept of using headers. When I try to delete any of my includes the program breaks even more, but says the class type is being defined more than once.

Horse.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef HORSE_H
#define HORSE_H

#include <iostream>
using namespace std;

// use header to declare horse class,
class Horse
{
private:
	string name;
	string rider;
	int maxRunningDistPerSecond;
	int distanceTraveled;
	int racesWon;
public:
	void setName(string);
	void setRider(string);
	int getMaxRunningDistPerSecond() const;
	int getDistanceTraveled() const;
	int getRacesWon() const;


};

#endif 



Horse.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
#include "Horse.h"


using namespace std;

// define horse class with all information to be stored
class Horse
{
private:
	string name;
	string rider;
	int maxRunningDistPerSecond;
	int distanceTraveled;
	int racesWon;
public:
	void setName(string input)
	{
		name = input;
	}
	void setRider(string input)
	{
		rider = input;
	}
	int getMaxRunningDistPerSecond() const;
	int getDistanceTraveled() const;
	int getRacesWon() const;


};



main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "stdafx.h"

// A Horse racing simulation program
#include <iostream>
#include <string>
#include "Horse.h"


using namespace std;


int main()
{
	int numHorses = 0;
	Horse horseArr[20] {};


	// determine number of horses in race
	cout << "How many horses are in the race?";
	cin >> numHorses;
	while (numHorses < 1 || numHorses > 20)
	{
		cout << "Please enter valid number of Horses";
		cin >> numHorses;
	}

	// create Class array for numHorses and get fill in horse and rider names
	for (int i = 0; i < numHorses - 1; i++)
	{
		cout << "Please enter the name of Horse " << i+1 << " : ";
		string input;
		getline(cin, input);
		horseArr[i].setName(input);
		
		cout << "Please enter the name of Rider for Horse " << i + 1 << " : ";
		getline(cin, input);
		Horse setRider(string input);


	}


	return 0;
}
closed account (48T7M4Gy)
Please close this one off. Thks
http://www.cplusplus.com/forum/general/178512/
Topic archived. No new replies allowed.