Multiple Definition of "Entity" (main.cpp)
First Defined in here (player.cpp)
so my entity struct looks like this:
Code: Select all
#ifndef ENTITY.H
#define ENTITY.H
struct Entity
{
int x,y,w,h;
int getX() { return x;}
int getY() { return y;}
int getW() { return w;}
int getH() { return h;}
void setX(int X){x = X;}
} Entity1;
#endif
Code: Select all
#ifndef PLAYER.H
#define PLAYER.H
#include <SDL/SDL.h>
#include "Entity.h"
class cPlayer: public Entity
{
private:
public:
cPlayer(SDL_Rect *rect);
void PlayerShow(SDL_Surface* src, SDL_Rect *dst,SDL_Surface *screen);
};
#endif
Code: Select all
#include <SDL/SDL.h>
#include "Player.h"
#include "Engine.h"
#include <SDL/SDL.h>
cPlayer::cPlayer(SDL_Rect *rect) // this is the line where it sais it was first defined
{
rect->x = getX();
rect->y = getY();
rect->w = getW();
rect->h = getH();
}
cEngine engine;
void cPlayer::PlayerShow(SDL_Surface *src, SDL_Rect *dst,SDL_Surface *screen)
{
engine.RenderDynamicSurface(src,NULL,screen,dst);
}