Entities.h :
#include "Map.h"
#include "TextureManager.h"
#include "Components.h"
#include "ECS.h"
#include "Vector2D.h"
#include "Collision.h"
#include "AnimateComponent.h"
extern Manager t_manager;
extern Entity& t_sky(t_manager.addEntity());
Entities.cpp :
#include "Entities.h"
void Entities::initent()
{
t_sky.addComponent<TransformComponent>(0, 0, 640, 800, 1);
}
game.cpp :
#include "Entities.h"
Manager manager = t_manager;
Entity& sky(manager.addEntity());
void Game::init(const char *title,int xpos,int ypos,int width,int height,bool fullscreen)
{
manager = t_manager;
sky = t_sky;
}
and I get the Error:
LNK2005 “class Entity & t_sky” (?t_sky@@3AEAVEntity@@EA) already defined in Entities.obj
I have tried changing the files I include in each file but nothing seems to work.
Thank you in advance.
New contributor
Ragnar123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1