Why does this happen? C++ Error: Unable to open file D:\Animals\Animals\Debug\Animals.obj

0

So i'm making a game (like Pokémon) and i changed some stuff and now i get : Error: Unable to open file D:\Animals\Animals\Debug\Animals.obj. Error code = 0x80070002.Error: Could not find 'D:\Animals\Animals\Debug\Animals.obj'. Animals.exe was built with /DEBUG:FASTLINK which requires object files for debugging.

Anybody know what is going on and how to fix this?

I used Visual Studio 2019 and x86 (and x64) debug.

My code :

animal.h :

#include <string>
#include <stdio.h>
#include <iostream>

#ifndef ANIMAL_H
    #define ANIMAL_H

using namespace std;
namespace Animals {
    class Animal {
    public:
        string name;
        int minlevel;
        int level;
        int maxlevel;
        int baseattack;
        int baseattackraise;
        int attack;
        int basedefense;
        int basedefenseraise;
        int defense;
        int basespeed;
        int basesppedraise;
        int speed;
        int basespecial;
        int basespecialraise;
        int special;
        char type;
        Animal() {
            this->name = "DOG";
            this->minlevel = 0;
            this->level = 1;
            this->maxlevel = 100;
            this->baseattack = 1;
            this->baseattackraise = 1;
            this->basedefense = 1;
            this->basedefenseraise = 1;
            this->basespecial = 1;
            this->basespecialraise = 1;
            this->basespeed = 1;
            this->basesppedraise = 1;
            this->attack = 1;
            this->defense = 1;
            this->speed = 1;
            this->special = 1;
        };
    private:
        void  printstats() {
            cout << "\t \t" << "Attack : " << this->attack << endl;
            cout << "\t \t"<<"Defense : " << this->defense << endl;
            cout << "\t \t"<<"Speed : " << this->speed << endl;
            cout <<"\t \t" << "Special : " << this->special << endl;
        };
        void raiseattack() {
            this->attack += this->baseattackraise;
        }
        void raisedefense() {
            this->defense += this->basedefenseraise ;
        }
        void raisespeed() {
            this->speed += this->basesppedraise;
        }
        void raisespecial() {
            this->special += this->basespecialraise;
        }
        void raisestats() {
            raiseattack();
            raisedefense();
            raisespeed();
            raisespecial();
        }
        void updatestats(char  type) {
            switch (type) {
            case 'l':
                raisestats();
            }
        }
    public :
        void raiselevel() {
                this->level++ ;
                this->type = 'l';
                updatestats(this->type);
                string output = "Level Up! Your " + this->name +" has reached level : ";
                cout << output << this->level << " . Its stats are now: " << endl;
                printstats();
        };
    };

}
#endif

Animals.cpp :

// Animals.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
void startgame();
void askname();
void asktype();
void giveGrassStarter();
void giveWaterStarter();
void giveFireStarter();
#include <iostream>
#include "plantee.h"
#include "wateree.h"
#include "flamee.h"
#include "animal.h"
// #include "visualanimal.h"
#include <cstring>
using namespace std;
string name;

int main()
{
    using namespace Animals;
    startgame();
    return 0;
}
void startgame() {
    char answer = 'N';
    while (answer == 'N') {
        askname();
        cout << "Alright then. You're " << name << " , right?" << "(Y/N)";
        cin >> answer;
    }
    asktype();
}
void askname() {
    cout << "Welcome. Your Journey In the World Of Animals Starts here . Please input your name";
    cin >> name;
}
void asktype() {
    char type;
    cout << "Welcome " << name << " . What type do you prefer? Water ? Grass? Fire? (W/G/F)";
    cin >> type;
    switch (type) {
    case 'G':
        giveGrassStarter();
        break;
    case 'W':
        giveWaterStarter();
        break;
    case 'F':
        giveFireStarter();
        break;
    default:
        cout << "Input invalid . (G for Grass , W for Water , F for Fire)";
        asktype();
    }
}

void giveGrassStarter()
{
    cout << "So you chose Plantee , the grass-type starter. Good choice";
    Plantee starter;
}

void giveWaterStarter()
{
    cout << "So you chose Wateree , the water-type starter. Good choice";
    Wateree starter;
}

void giveFireStarter()
{
    cout << "So you chose Flamee , the fire-type starter. Good choice";
    Flamee starter;
}

Anybody know a possible fix? I'd also like if you explained what was going on.

c++
asked on Stack Overflow Jul 30, 2020 by CoolNite

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0