I know what this error is, and what it means, but for the life of me, I cant find the problem. (I'm working on a game which allows for the crafting of modular equipment, and that's where the breakdown is happening.)
to the best of my knowledge I have:
-I've included all the #includes that I need.
-I've checked my functions to make sure they have definitions
-I've made sure everything is squared away with how the classes are communicating
here's some of the code(I have 21 item types right now, so I'm gonna just use a few pieces):
//this is just a piece of this function, but it's just the same thing all the way down. This is where the breakdown seems to be happening.
void Inventory::chooseItem(int tag)
{
switch (tag)
{
//armor
case '1':
addArmorBack(makeNewArmor1(holder.back()));
break;
case '2':
addArmorBreastplate(makeNewArmor2(holder.back()));
break;
case '3':
addArmorStraps(makeNewArmor3(holder.back()));
break;
//The relevant data holders in the private area of the .h:
vector<ItemPart> holder;
ArmorBack makeNewArmor1(ItemPart held);
ArmorBreastplate makeNewArmor2(ItemPart held);
ArmorStraps makeNewArmor3(ItemPart held);
//item part lists
vector<ArmorBack> armorBackList;
vector<ArmorBreastplate> armorBreastplateList;
vector<ArmorStraps> armorStrapsList;
//This is a sample of the functions I'm using to add things to my list. It's the same function for each item.
void Inventory::addArmorBack(ArmorBack makeNew)
{
string name;
armorBackList.push_back(makeNew);
name = makeNew.getName();
addItem(name);
}
//the ItemPart class recieves data, then other functions direct the data to the right item part using the tag int:
class ItemPart
{
public:
ItemPart(int attack, int defense, int health, int experienceMult, int tag, string name);
//setters
void setName();
//getters
int getDefense();
int getAttack();
int getHealth();
int getExperienceMult();
int getTag();
string getName();
private:
string _name;
int _defense;
int _attack;
int _health;
int _experienceMult;
int _tag;
};
//finally, the relevant item class recieves the data:
ArmorBack::ArmorBack(ItemPart crafted)
{
_attack = crafted.getAttack();
_defense = crafted.getDefense();
_health = crafted.getHealth();
_experienceMult = crafted.getExperienceMult();
_tag = crafted.getTag();
_name = crafted.getName();
}
edit: here's the error text. I have one of these for each item type I've implemented:
Error 37 error LNK2019: unresolved external symbol "private: class ArmorBack __thiscall Inventory::makeNewArmor1(class ItemPart)" (?makeNewArmor1@Inventory@@AAE?AVArmorBack@@VItemPart@@@Z) referenced in function "public: void __thiscall Inventory::chooseItem(int)" (?chooseItem@Inventory@@QAEXH@Z) C:UsersForrestoDocumentsVisual Studio 2012Projectsgame challenge asciigame challenge asciiInventory.obj game challenge ascii
Aucun commentaire:
Enregistrer un commentaire