I'm creating a mini console game and suddenly it couldn't compile because of identifier not found error(C3861) in all functions. I think that's not a code problem becouse when i had 2 fever functions it worked. Now none of the functions work (i've tried moving all functions before the Virables section where the problem appears). Here is the important part of the code. Edit: The problem is only to functions that are in class'es (struct)
#include <iostream>
#include <string>
#include <Windows.h>
#include <cstdlib>
#include <time.h>
#include <random>
using namespace std;
//-------------------------------------------Virables-------------------------------------------//
struct LevelObject
{
string name;
string look;
bool enabled = true;
bool interactable = false;
void Interact(string requaierment,string Text,string itemGiven)
{
if (interactable == true)
{
if (requaierment == "none")
{
cout << Text << endl;
GiveItem(itemGiven);
}
else if (ItemCheck(requaierment))
{
cout << Text << endl;
GiveItem(itemGiven);
RemoveItem(requaierment);
}
else
{
cout << "You don't have the needed item to do this" << endl;
}
}
else
{
cout << "It seems like you can't do anything with this" << endl;
}
}
};
struct Item
{
string name;
bool isHere = false;
string description;
};
struct Level
{
int id = 0;
string LvlText, Look;
Item item[5];
LevelObject Obj[3];
int foward_level = 100;
int back_level = 100;
int left_level = 100;
int right_level = 100;
};
struct Player
{
Level CurrentLevel;
Item inv[20];
};
Player player;
Level level[50];
string Input;
//-------------------------------------------Functions------------------------------------------//
void RemoveItem(string ItemName2)
{
for (int i = 0; i < 20;)
{
if (player.inv[i].name == ItemName2)
{
player.inv[i].name = "";
break;
}
i++;
}
}
bool ItemCheck(string ItemName1)
{
bool T_F = false;
for (int i = 0; i < 20;)
{
if (player.inv[i].name == ItemName1)
{
bool T_F = true;
break;
}
i++;
}
return T_F;
}
void TakeItem(string ItemName0)
{
for (int i = 0; i < 3;)
{
if (player.CurrentLevel.item[i].name == ItemName0 && player.CurrentLevel.item[i].isHere == true)
{
GiveItem(ItemName0);
player.CurrentLevel.item[i].isHere = false;
break;
}
if (i == 2)
{
cout << "There is no such item" << endl;
}
i++;
}
}
void GiveItem(string ItemName)
{
for (int i = 0; i < 20;)
{
if (player.inv[i].name == "")
{
player.inv[i].name = ItemName;
break;
}
i++;
}
}
void ColorText(std::string Text0, int Color, bool endl)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color);
if (endl == true)
{
std::cout << Text0 << std::endl;
}
else if (endl == false)
{
std::cout << Text0;
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
}
void inventory()
{
ColorText("---------INVENTORY--------", 9, true);
for (int i = 0; i < 20;)
{
if (player.inv[i].name != "")
cout << "- " << player.inv[i].name << endl;
i += 1;
}
ColorText("--------------------------", 9, true);
}
int main()
{
while (true)
{
cin >> Input;
}
}