I keep getting these errors when I run the code below: Code is in C++ ____animal.cpp_______ #include "animal.h" Animal::Animal() { } Animal::Animal(string name,string gender, string color, double weight) { this->name = name; this->gender = gender; this->color = color; this->weight = weight; } void Animal::PrintInfo() { cout<<"Name : "< using namespace std; class Animal { private: double weight; string name; string gender; string color; public: Animal(); Animal(string,string , string, double); virtual void PrintInfo(); }; #endif   ___horse.h___ #ifndef __HORSE_H #define __HORSE_H #include "animal.h" class Horse : public Animal { private: string breed; int id; string comments; public: Horse(); Horse(string,double,string,string,int,string,string); void PrintInfo(); }; #endif   ____horse.cpp____ #include "horse.h" Horse::Horse() { } Horse::Horse(string breed, double weight , string name ,string gender, int id, string color , string comments):Animal(name,gender,color,weight) { this->breed = breed; this->id = id; this->comments = comments; } void Horse::PrintInfo() { Animal::PrintInfo(); cout<<"Breed : "<breed<id<comments< #include void clearBuffer() { cin.clear(); cin.ignore(numeric_limits::max(),'\n'); } int main() { int size = 5; Horse *snakes = new Horse[5]; string breed; double weight; string name; string gender; int id; string color ; string comments; for(int i = 0;i> weight; clearBuffer(); cout<<"Enter Name : "; getline(cin,name); cout<<"Enter Gender : "; getline(cin,gender); cout<<"Enter Id : "; cin >> id; clearBuffer(); cout<<"Enter Color : "; getline(cin,color); cout<<"Enter Comments : "; getline(cin,comments); snakes[i] = Horse(breed,weight,name,gender,id,color,comments);; } for(int i = 0;iPrintInfo(); } delete[] snakes; return 0; }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I keep getting these errors when I run the code below: Code is in C++

____animal.cpp_______

#include "animal.h"
Animal::Animal()
{
}
Animal::Animal(string name,string gender, string color, double weight)
{
this->name = name;
this->gender = gender;
this->color = color;
this->weight = weight;
}
void Animal::PrintInfo()
{
cout<<"Name : "<<name<<endl;
cout<<"Gender : "<<gender<<endl;
cout<<"Color : "<<color<<endl;
cout<<"Weight : "<<weight<<endl;
}

__animal.h___

#ifndef __ANIMAL_H
#define __ANIMAL_H
#include<iostream>
using namespace std;
class Animal
{
private:
double weight;
string name;
string gender;
string color;
public:
Animal();
Animal(string,string , string, double);
virtual void PrintInfo();
};
#endif

 

___horse.h___

#ifndef __HORSE_H
#define __HORSE_H
#include "animal.h"

class Horse : public Animal
{
private:
string breed;
int id;
string comments;
public:
Horse();
Horse(string,double,string,string,int,string,string);
void PrintInfo();
};
#endif

 

____horse.cpp____

#include "horse.h"
Horse::Horse()
{
}
Horse::Horse(string breed, double weight , string name ,string gender, int id, string color , string comments):Animal(name,gender,color,weight)
{
this->breed = breed;
this->id = id;
this->comments = comments;
}
void Horse::PrintInfo()
{
Animal::PrintInfo();
cout<<"Breed : "<<this->breed<<endl;
cout<<"Id : "<<this->id<<endl;
cout<<"Comments : "<<this->comments<<endl;
}

 

 

____ horsemain.cpp_____

#include "horse.h"
#include<limits>
#include<cstdlib>

void clearBuffer()
{
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(),'\n');
}

int main()
{
int size = 5;
Horse *snakes = new Horse[5];
string breed;
double weight;
string name;
string gender;
int id;
string color ;
string comments;
for(int i = 0;i<size;i++)
{

cout<<"\nEnter Breed : ";
getline(cin,breed);
cout<<"Enter Weight : ";
cin >> weight;
clearBuffer();
cout<<"Enter Name : ";
getline(cin,name);

cout<<"Enter Gender : ";
getline(cin,gender);
cout<<"Enter Id : ";
cin >> id;
clearBuffer();
cout<<"Enter Color : ";
getline(cin,color);
cout<<"Enter Comments : ";
getline(cin,comments);

snakes[i] = Horse(breed,weight,name,gender,id,color,comments);;

}

for(int i = 0;i<size;i++)
{
Animal *animal;
animal = &snakes[i];
cout<<"\n";
animal->PrintInfo();
}

delete[] snakes;
return 0;
}

iput vieW
Build
Search
A Replace
References
Output
Git
/usr/bin/make -j8 -e -f Makefile
---Building project:[ animal.h
Debug ]---
/usr/bin/g++ -o Debug/animal.h @"animal.h.txt" -L.
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Debug/animal.h] Error 1
make: *** [ALl] Error 2
build ended with errors (1 errors, 0 warnings)
Transcribed Image Text:iput vieW Build Search A Replace References Output Git /usr/bin/make -j8 -e -f Makefile ---Building project:[ animal.h Debug ]--- /usr/bin/g++ -o Debug/animal.h @"animal.h.txt" -L. Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [Debug/animal.h] Error 1 make: *** [ALl] Error 2 build ended with errors (1 errors, 0 warnings)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY