So, I'm writing a roguelike game in C++. But, its complaining about a class I made called "Player" in the file "player.h" in the file "monster". When I input into monster this function:
void attackplayer(Player& hero, bool checkup, bool checkdown, bool checkleft, bool checkright)
{
if (checkup == true || checkdown == true || checkleft == true || checkright == true)
{
hero.damage(damage);
}
}
with player.h included, it complains hero is of an error type, even though it is initialized as a player. How do I fix this? It used to complain it couldn't find the Player Identifier, but it seemed to fix itself on that.
Here is the build message:
1> Simple Rogue
1>c:\users\gio\desktop\documents\c++ programs\2d & 3d games\roguelike game\roguelike game\monster.h(56): error C2061: syntax error : identifier 'Player'
1>c:\users\gio\desktop\documents\c++ programs\2d & 3d games\roguelike game\roguelike game\monster.h(58): error C2065: 'checkup' : undeclared identifier
1>c:\users\gio\desktop\documents\c++ programs\2d & 3d games\roguelike game\roguelike game\monster.h(58): warning C4805: '==' : unsafe mix of type ''unknown-type'' and type 'bool' in operation
1>c:\users\gio\desktop\documents\c++ programs\2d & 3d games\roguelike game\roguelike game\monster.h(58): error C2065: 'checkdown' : undeclared identifier
1>c:\users\gio\desktop\documents\c++ programs\2d & 3d games\roguelike game\roguelike game\monster.h(58): warning C4805: '==' : unsafe mix of type ''unknown-type'' and type 'bool' in operation
1>c:\users\gio\desktop\documents\c++ programs\2d & 3d games\roguelike game\roguelike game\monster.h(58): error C2065: 'checkleft' : undeclared identifier
1>c:\users\gio\desktop\documents\c++ programs\2d & 3d games\roguelike game\roguelike game\monster.h(58): warning C4805: '==' : unsafe mix of type ''unknown-type'' and type 'bool' in operation
1>c:\users\gio\desktop\documents\c++ programs\2d & 3d games\roguelike game\roguelike game\monster.h(58): error C2065: 'checkright' : undeclared identifier
1>c:\users\gio\desktop\documents\c++ programs\2d & 3d games\roguelike game\roguelike game\monster.h(58): warning C4805: '==' : unsafe mix of type ''unknown-type'' and type 'bool' in operation
1>c:\users\gio\desktop\documents\c++ programs\2d & 3d games\roguelike game\roguelike game\monster.h(60): error C2065: 'hero' : undeclared identifier
1>c:\users\gio\desktop\documents\c++ programs\2d & 3d games\roguelike game\roguelike game\monster.h(60): error C2228: left of '.damage' must have class/struct/union
1> type is ''unknown-type''
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========