jeudi 26 février 2015

Undefined Reference to Function error?


I have seen other similar questions being asked but I could not figure out what the problem is. I have a declaration in an inventory class as:



class Inventory
{
Public:
void print();
void sell(Item*);
void add();
void find(string);
Private:
Item* first;
}


And then in the inventory.cpp I have:



void sell(Item* item_name)
{
..........................
}


And the error comes from calling it in main() as:



Inventory store_inventory;
Item* cur_item;
cout<<"Item name: ";
string name;
cin>>name;
cur_item = find(name); //find returns Item*

store_inventory.sell(cur_item);


The error is one the line for the call to sell. Any ideas?




Aucun commentaire:

Enregistrer un commentaire