Why doesn't this work?

#include <iostream>
#include <string>
#include "Animal.h"
#include "Liger.h"

using namespace std;

int main()
{
//Animal MyAnimal;

Liger Leo;
Liger Sally;
Liger Rafiel;

Leo.setNumStripes (4);
Sally.setNumStripes (15);
Rafiel.setNumStripes (23);


/*MyAnimal.setHeight(5.0);
MyAnimal.setWeight(10.0);
MyAnimal.setHungry(true);
MyAnimal.setAlive(true);


cout << MyAnimal.getHeight() << "\n" <<
MyAnimal.getWeight() << "\n" << MyAnimal.isHungry()
<< "\n" << MyAnimal.isAlive() << endl;*/

cout << Leo.getNumStripes() << endl;
cout << Rafiel.getNumStripes() << endl;


return 0;
}
THIS IS THE OUTPUT FOR THE BUILD

1>------ Build started: Project: AnimalProject2, Configuration: Debug Win32 ------
1> Zoo.cpp
1>c:\users\brandonlnelson\documents\visual studio 2010\projects\animalproject2\animalproject2\animal.h(7): error C2011: 'Animal' : 'class' type redefinition
1> c:\users\brandonlnelson\documents\visual studio 2010\projects\animalproject2\animalproject2\animal.h(7) : see declaration of 'Animal'
1>c:\users\brandonlnelson\documents\visual studio 2010\projects\animalproject2\animalproject2\liger.h(8): error C2504: 'Animal' : base class undefined
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
One problem looks like it is in your animal.h file so maybe post that also.
closed account (z05DSL3A)
Have you guarded your headers from multiple inclusion?
Sounds like you need header guards.
Topic archived. No new replies allowed.