I started writing a program in dev-C++ for a game and tried to move my work over to qt creator using microsoft visual’s compiler(qt didn’t like dev’s GCC). When I copied everything over I got compile errors saying qt doesn’t recognize my enumerated data type as a type.
In data.h:
enum StatType {Health, Armor, Mana, HealthRegeneration, ManaRegeneration, AttackDamage,
AbilityPower, LifeSteal, SpellVamp, MovementSpeed, AttackSpeed,
CooldownReduction, MagicResist, MagicPenetration, ArmorPenetration,
MovementSpeedPercent, CriticalDamage, CriticalChance, Gold, Experience,
TimeDead, Energy, EnergyRegeneration, PercentHealth, None};
In glyph.h:
#include <QString>
#include "data.h"
using namespace std;
class Glyph
{
public:
QString name;
double statAmount;
StatType stat;
bool isStatic;
int costIP;
double bonusAtLevel(int level);
Glyph();
};
The exact errors:
e:\shared\stuff to save\gaming\lol\champion builder\qt\lol_champion_builder\glyph.h:20: error: C2146: syntax error : missing ‘;’ before identifier ‘stat’
e:\shared\stuff to save\gaming\lol\champion builder\qt\lol_champion_builder\glyph.h:20: error: C4430: missing type specifier – int assumed. Note: C++ does not support default-int
e:\shared\stuff to save\gaming\lol\champion builder\qt\lol_champion_builder\glyph.h:20: error: C2208: ‘stat’ : no members defined using this type
edit: I believe I’ve solved the problem – I had the enum declaration below the include statements.
↧