Reference to Player::player without declare? [duplicate]

  c++, class, game-engine, oop

I’m using a framework, I read another questions similar to this one but I don’t find the solution. I did the Player class in world.cpp and world.h

#define WORLD_H

#include <iostream>
#include "image.h"
#include "framework.h"
#include "includes.h"
#include "utils.h"


class Player{
  public:
    Vector2 pos;
    Image sprite;
    bool isControlled;

    Player();
    Player(Vector2 pos, Image sprite);

    Image getSprite(){ return sprite; }
};

#endif

and world.cpp

#include "image.h"

Player::Player(){
  this->pos = Vector2();
  this->sprite = NULL;
  this->isControlled = false;
}

Player::Player(vector2 pos, Image sprite){
    this->pos = pos;
  this->sprite = sprite;
  this->isControlled = true;
}

And I trying to pass it in to Game.cpp

#include "utils.h"
#include "input.h"
#include "image.h"
#include "world.h"
#include <cmath>

Game* Game::instance = NULL;

Image font;
Image minifont;
Image player_sprite;
Player hezurdur;
Color bgcolor(130, 80, 100);

But then I get this error saying that Player::player() is not defined which I don’t understand.
/usr/bin/ld: CMakeFiles/TJE.dir/src/game.cpp.o: en la funciĆ³n `__static_initialization_and_destruction_0(int, int)': game.cpp:(.text+0x851): referencia a `Player::Player()' sin definir (this translates as reference to Player::player() without define.

Source: Windows Questions C++

LEAVE A COMMENT