Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: link issues  (Read 1653 times)

0 Members and 2 Guests are viewing this topic.

booncoder

  • Newbie
  • *
  • Posts: 9
    • View Profile
link issues
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
link issues
« Reply #1 on: March 16, 2010, 06:44:53 pm »
Static members must be defined in the cpp file
Code: [Select]
sf::Image Submarine::submarine;
Laurent Gomila - SFML developer

booncoder

  • Newbie
  • *
  • Posts: 9
    • View Profile
link issues
« Reply #2 on: March 16, 2010, 06:45:45 pm »
ahh i see thanks

 

anything