-3

ここに私の問題のエラーレポートがあります:

Error   2   error LNK2019: unresolved external symbol 
"public: int __thiscall item::getSubstanceDurability(enum myEnums::MATERIAL)" (?getSubstanceDurability@item@@QAEHW4MATERIAL@myEnums@@@Z) referenced in function 
"public: virtual void __thiscall armor::setHardness(enum myEnums::MATERIAL,int)" (?setHardness@armor@@UAEXW4MATERIAL@myEnums@@H@Z)  
C:\Users\Raenir Salazar\My Projects\COMP345_Assignment2\COMP345_Assignment2\armor.obj   COMP345_Assignment2

コンパイルしようとすると発生します。これが私のコードです:

アイテム.cpp

int getSubstanceHardness ( MATERIAL substance ) {
    switch (substance) {
    case 0:
        return 0;
        break;
    case 1:
        return 0;
        break;
    case 2:
        return 0;
        break;
    case 3:
        return 1;
        break;
    case 4:
        return 0;
        break;
    case 5:
        return 2;
        break;
    case 6:
        return 5;
        break;
    case 7:
        return 8;
        break;
    case 8:
        return 10;
        break;
    case 9:
        return 15;
        break;
    case 10:
        return 20;
        break;
    case 11:
        return 5;
        break;
    default:
        return 0;
        break;

    }
}

Items.h

int getSubstanceDurability ( MATERIAL );

鎧。h & 鎧.cpp

class armor: public item {
    protected:
        int armorClass;
        int armorCheckPenalty;
        double arcaneSpellFailure;
        int maxDEXBonus;
        int speedPenalty;
        CHARACTER_ARMOR armorType;
    public:
        armor();
        armor( int, int, double, string, int, int, double, double, 
            CHARACTER_ARMOR, SIZE, MATERIAL, int /*+X*/ );

        int getArmorClass ();
        void setArmorClass ( int );
        int getArmorCheckPenalty ();
        void setArmorCheckPenalty( int );
        double getArcaneSpellFailure ();
        void setArcaneSpellFailure ( double );
        //void setArmorName ( string );
        int getMaxDEXBonus ();
        void setMaxDEXBonus ( int );
        int getspeedPenalty ();
        void setspeedPenalty ( int );
        CHARACTER_ARMOR getArmorType();
        void setArmorType( CHARACTER_ARMOR );
        void setDurability( MATERIAL, int /*AC*/, int /* +X */, SIZE );
        void setHardness( MATERIAL, int /* enhancement */ );
};

void armor::setHardness( MATERIAL substance, int enhancement ) {
    int substanceDensity; 
    substanceDensity = this->getSubstanceDurability( substance );
    int density;
    density = substanceDensity + (enhancement * 2);

    this->hardness = density;

    //this->hardness = ((this->getSubstanceDurability(substance)) + (enhancement * 2));
}

enum.h

#ifndef ENUM_H
#define ENUM_H

namespace myEnums
{
        enum CHARACTER_CLASS
        {
            FIGHTER, CLERIC, WIZARD,
            ROGUE, DRUID, RANGER, BARD,
            SORCERER, PALADIN

        };
        enum CHARACTER_WEAPON
        {
            NOTHING, LONGSWORD, SHORTSWORD, KATANA, AMMUNITION, GRAPPLE, RAY
        };
        enum WEAPON_CATEGORY 
        {
            SIMPLE, MARTIAL, EXOTIC,
        };
        enum WEAPON_SUBCATEGORY
        {
            UNARMED, LIGHT_MELEE, ONE_HANDED_MELEE, TWO_HANDED_MELEE, RANGED
        };
        enum CHARACTER_ARMOR
        {
            UNARMORED, CHAINMAIL, PADDED
        };
        enum CHARACTER_SHIELD
        {
            NONE, BUCKLER, LIGHT_WOODEN, LIGHT_STEEL, HEADY_WOODEN,
            HEAVY_STEEL, TOWER
        };
        enum CHARACTER_RACE
        {
            HUMAN, ELF, DROW, HALFLING,
            DWARF, GNOME
        };
        enum SIZE
        {
            FINE, DIMINUTIVE, TINY, SMALL, 
            MEDIUM, LARGE, HUGE, GARGANTUAN, 
            COLOSSAL, COLOSSAL_P, COLOSSAL_PP
        };
        enum DAMAGE_TYPE
        {
                // This one is tricky, some weapons
                // Can have multiple damage types...
            BLUDGEONING, SLASHING, PIERCING
        };
        enum MATERIAL
        {
            PAPER, CLOTH, ROPE, GLASS, ICE, LEATHER, WOOD,
            STONE, METAL, MITHRAL, ADAMANTINE, SOFT_METALS
        };
        enum BAB_PROGRESSION 
        {
            HIGH, MID, LOW
        };
        enum SAVING_THROW
        {
            HIGH_SAVE, LOW_SAVE
        };
};

何が問題なのかわかりません。オーバーロードと署名をいじって、データ型を再確認しようとしていますが、実際の構文エラーは何もありません。私の知る限り...

4

1 に答える 1