main.cpp:
#include <iostream>
#include "person.h"
using namespace std;
int main(){
Person human;
human.setName("frank");
cout << human.toString() << endl;
cout << "Name of person with get method: " << human.getName() << endl;
return 0;
}
person.h:
#ifndef PERSON_H_INCLUDED
#define PERSON_H_INCLUDED
#include <iostream>
using namespace std;
class Person
{
private:
string name;
public:
Person();
string toString();
void setName(string newName);
string getName();
};
#endif
person.cpp:
#include "person.h"
Person::Person()
{
name = "George";
}
string Person::toString()
{
return "Persons name is: " + name;
}
void Person::setName(string newName)
{
name = newName;
}
string Person::getName()
{
return name;
}
This is all my code from the program. When i run the program through visual studio code i get an error message that says: "c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status"