class Missile
{
public :
static bool Init(const std::string& ImageFile)
{
return Image.LoadFromFile(ImageFile);
}
Missile()
{
Sprite.SetImage(Image); // every sprite uses the same unique image
}
private :
static sf::Image Image; // shared by every instance
sf::Sprite Sprite; // one per instance
};
i want this to be in seperate files, but
#include "sfml-graphic.hpp"
class Missile
{
public :
static bool Init(const std::string& ImageFile);
Missile();
private :
static sf::Image Image; // shared by every instance
sf::Sprite Sprite; // one per instance
};
in .h and
#includes
static bool Missile::Init(...)
{
return Image.LoadFromFile(...)
}
Missile::Missile()
{
Sprite.SetImage(Image); // every sprite uses the same unique image
}
doesnt work
i already asked in a c++ forum but i dont get a answer
edit : code::blocks says :
C:\Programme\CodeBlocks\MEINS\Object\object.cpp|16|error: cannot declare member function `static bool object::Init(const std::string&)' to have static linkage|
||=== Build finished: 1 errors, 0 warnings ===|