Hey guys, so I have another assignment and I've got it all ready to go, but when I try to build it, I'm getting an unresolved external symbol error again. I'm not sure why, I've included and added all header and implementation files. What am I doing wrong?
#include <iostream>
#include <string>
usingnamespace std;
/* A class that consists of a persons' name and age
*/
class Person{
public:
/* constructs a Person object with parameters
parameter personName = name
parameter personAge = age
*/
Person(string personName, int personAge);
/* constructs a Person object with default
parameters
*/
Person();
/* sets the name of the person
parameter newName = new person name
*/
void setName(string newName);
/* sets the age of the person
parameter newAge = new person age
*/
void setAge(int newAge);
/* gets the name of the person
and returns it
*/
string getName();
/* get the age of the person
and returns it
*/
int getAge();
private:
string name;
int age;
};
The problem is that, in your header file, your class claims to have a Person constructor which takes no arguments. Your compiler is like "Okay cool", but it never finds an implementation for that constructor (it doesn't find it because it doesn't exist - you didn't write it).