'C2011 'Entity': 'class' type redefinition [duplicate]
So i got this code over here:
Entity.h
class Entity
{
public:
DWORD Get(int Index);
int GetHealth(DWORD Entity);
int GetTeam(DWORD Entity);
};
Entity.cpp
DWORD Entity::Get(int Index)
{
return *(DWORD*)(Global_GameModule + dwEntityList + (Index * 0x10));
}
int Entity::GetHealth(DWORD Entity)
{
return *(int*)(Entity + m_iHealth);
}
int Entity::GetTeam(DWORD Entity)
{
return *(int*)(Entity + m_iTeamNum);
}
And i get this error : Error C2011 'Entity': 'class' type redefinition
could somebody tell me how do i solve this?
Solution 1:[1]
The most probable cause of this is that you do not have an include guards in the header file(Entity.h).
So to solve this just add the header guards as shown below:
#ifndef ENTITY_H
#define ENTITY_H
class Entity
{
public:
DWORD Get(int Index);
int GetHealth(DWORD Entity);
int GetTeam(DWORD Entity);
};
#endif
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Anoop Rana |
