SFML community forums

Help => Graphics => Topic started by: booncoder on March 16, 2010, 06:40:20 pm

Title: link issues
Post by: booncoder on March 16, 2010, 06:40:20 pm
im trying to load and image and convert it to a sprite inside a class by using some kind of image management here is the code.
Code: [Select]

class Submarine:public sf::Sprite
{
private:
short int energy;
sf::Sprite subSprite;
static sf::Image submarine;
public:
Submarine()
    {
subSprite.SetImage(submarine);
cout<<"Sprite created";
initSprite("images/submarine.png");
    }
static bool initSprite(const string& Imagefile)
{
return submarine.LoadFromFile(Imagefile);


};
};

error is LNK2001: unresolved external symbol "private: static class sf::Image Submarine::submarine" (?submarine@Submarine@@0VImage@sf@@A)
of corse the header files are there
Title: link issues
Post by: Laurent on March 16, 2010, 06:44:53 pm
Static members must be defined in the cpp file
Code: [Select]
sf::Image Submarine::submarine;
Title: link issues
Post by: booncoder on March 16, 2010, 06:45:45 pm
ahh i see thanks