I’m making a game in SDL, and assigning objects with a bitmap, i wanted to try static, but i get an error that the declaration is incompatible. What am i missing?
my class cpp
SDL_Surface Enemy::sprite = SDL_LoadBMP("ship.bmp");
my class h
class Enemy
{
public:
static SDL_Surface *sprite;
};
As pointed out by user786653, you are missing an asterix in your declaration,
should be correct. As is, the type of the variable in your class header is a pointer to an SDL_Surface, but the static declaration in your cpp file is for a straight SDL_Surface.