It was working perfectly fine until I added the People class and the People.cpp in my eclipse file. The error is in the three lines with the Human types in People.h. Here are the files.
#ifndef SRC_PEOPLE_H_
#define SRC_PEOPLE_H_
#include "Human.h"
class People {
private:
int size;
int position;
public:
People();
People(int size, int position);
void setSize(int size);
void setPosition(int position);
int getSize();
int getPosition();
Human search(std::string name);
Human insert(Human newHuman);
Human humans[];
};
#endif /* SRC_PEOPLE_H_ */
#include "Human.h"
#include <iostream>
#include "ArrayList.h"
#include "People.h"
usingnamespace std;
int main() {
//ArrayList can have add, remove and get
ArrayList <std::string> list;
//Human h;
std::string input;
Human *humanList = new Human[4];
humanList[0]=Human("Groot", 100, "I am Groot");
humanList[1]=Human("Bob", 20, "Hello");
humanList[2]=Human("asdsg", 4, "...");
while(input != "stop") { //when user says "stop" then the program exits
cout << "Input a string or stop to end ";
cin >> input;
list.add(input);
cout << "Phrase: " << humanList[0].getPhrase() << endl; //person says their phrase
list.add(humanList[0].getPhrase());
humanList[0].setAge(humanList[0].getAge()+1); //their age increment by one
cout << "Age: " << humanList[0].getAge() << endl;
cin >> input;
humanList[0].setAge(humanList[0].getAge()+1); //their age increment by one
cout << "Age: " << humanList[0].getAge() << endl;
}
return 0;
}