In a school project I am working on, I basically have the project done. I have made a multi file program with classes that inherit from other classes, an enumeration, and methods. Naturally, several errors ensued. I have whittled down the error count to twelve. These twelve, as shown in the image, do not make sense to me at all, whatsoever. I was hoping I could get some expert insight as to what might be wrong, and what can be done about it.
Cyclic inclusion issue. Include only needed or use forward declaration.
--- PlayersAndEnemies\PlayersAndEnemies\PlayersAndEnemies.cpp 2019-11-10 08:54:28.000000000 +0900
+++ PlayersAndEnemies\PlayersAndEnemies\PlayersAndEnemies.cpp 2019-11-12 13:31:41.000000000 +0900
@@ -33,22 +33,22 @@
dwarf.position.x = 40;
dwarf.position.y = 67;
dwarf.position.z = 121;
//create first enemy character
EnemyCharacter hobgoblin;
- hobgoblin.monster = EnemyCharacter.enemyType.Goblinoid;
+ hobgoblin.monster = EnemyCharacter::enemyType::Goblinoid;
hobgoblin.charName = "grunk";
hobgoblin.hp = 450;
hobgoblin.position.x = 41;
hobgoblin.position.y = 67;
hobgoblin.position.z = 120;
//create second enemy character
EnemyCharacter skeleton;
- skeleton.monster = EnemyCharacter.enemyType.Undead;
+ skeleton.monster = EnemyCharacter::enemyType::Undead;
skeleton.charName = "rattles";
skeleton.hp = 300;
skeleton.position.x = 41;
skeleton.position.y = 67;
skeleton.position.z = 121;
--- PlayersAndEnemies\PlayersAndEnemies\WeaponObj.h 2019-11-09 23:23:40.000000000 +0900
+++ PlayersAndEnemies\PlayersAndEnemies\WeaponObj.h 2019-11-12 13:31:12.000000000 +0900
@@ -1,13 +1,11 @@
#pragma once
#include <string>
#include "BaseObj.h"
-#include "BaseCharacter.h"
-#include "PlayerCharacter.h"
-#include "EnemyCharacter.h"
+
using namespace std;
class WeaponObject : public BaseObject {
public:
string wType;
int damage;
int doDamage();
};
Alright, Thanks, I’ll try that out!
You absolute godsend of a programmer! Your advice resolved all of my problems! I am extremely grateful! I had no idea that improper inclusion could cause problems, but hey, I guess that’s just part of the learning process!