Every time I try to compile this program, it gets the following error:
Undefined symbols for architecture x86_64:
"Character::setTime(int)", referenced from:
awesome(Character) in ccmsAc4F.o
"Character::getMoney()", referenced from:
_main in ccmsAc4F.o
"Character::setMoney(double)", referenced from:
awesome(Character) in ccmsAc4F.o
"Character::Character()", referenced from:
_main in ccmsAc4F.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Character compiles correctly and has no errors. The problem seems to be trying to pass the object as a reference. The following is my program:
#include <cstdlib>
#include "Character.h"
#include <iostream>
using namespace std;
void awesome(Character& character);
int main() {
Character userCharacter;
awesome(userCharacter);
cout << userCharacter.getMoney();
return 0;
}
void awesome(Character& character)
{
character.setTime(0);
character.setMoney(0.00);
}
Does anyone have any insight on what I'm doing wrong? Ultimately in a larger program I want to use the reference to edit an already instantiated object. I'm assuming referencing is the right way to do it. Any help would be greatly appreciated.