Code (Left off some of the function definitions, if I comment them out it doesn't change anything):
#include <SFML/window.hpp>
#include <SFML/system.hpp>
#include <SFML/graphics.hpp>
#include <iostream>
const int SQUARE_HEIGHT = 80;
const int SQUARE_WIDTH = 80;
class Space
{
public:
static bool Init()
{
if ((WhiteSpace.LoadFromFile("WhiteSquare.bmp")) && (BlackSpace.LoadFromFile("BlackSquare.bmp")))
{
return true;
}
else
{
return false;
}
}
bool IsWhite();
char GetColor();
void SetColor(char NewColor);
Space(char NewColor);
private:
static sf::Image WhiteSpace;
static sf::Image BlackSpace;
char Color;
sf::Sprite SpaceSprite;
};
Space::Space(char NewColor):Color(NewColor)
{
if (NewColor == 'w')
{
SpaceSprite.SetImage(WhiteSpace);
}
else
{
SpaceSprite.SetImage(BlackSpace);
}
}
Errors:
1>Test2.obj : error LNK2001: unresolved external symbol "private: static class sf::Image Space::BlackSpace" (?BlackSpace@Space@@0VImage@sf@@A)
1>Test2.obj : error LNK2001: unresolved external symbol "private: static class sf::Image Space::WhiteSpace" (?WhiteSpace@Space@@0VImage@sf@@A)
Linker Input:
sfml-system-d.lib
sfml-window-d.lib
sfml-graphics-d.lib
Preprocessor Definitions:
SFML_DYNAMIC
WIN32
_CONSOLE
_DEBUG
This is basically the same thing that was done in this tutorial (
http://www.sfml-dev.org/tutorials/1.5/graphics-sprite.php) in the bottom section for Image and Sprites Management. If I remove the constructor everything compiles fine. I've tried running the Init() function in the Main() function, but this didn't change anything. I originally was passing the filenames, but changed this to hardcoded filenames as a way of testing.
I've read quite a few posts and done quite a bit of searching, everyone else with this issue was able to resolve it by either including the sfml-window.lib to the linker or adding the SFML_DYNAMIC to the preprocessor definitions.
I'm using VC++2008 Express Edition, on Windows Vista Ultimate 64.
I've added the sfml-graphics-d.dll, sfml-window-d.dll, and sfml-system-d.dll files to every folder and subfolder of this project. I've done the same with the BlackSquare.bmp and WhiteSquare.bmp files.
I'm trying to take the tutorial information and put it to a more practical use to learn a bit more about SFML, but these linkers and stuff are making me bang my head against the wall and getting me pretty discouraged. I've already uninstalled the SDL and GDK libraries for very similar reasons, no matter what I did I couldn't get them to work
I really like the way SFML is setup and want to get past this hurdle.
Thanks for any help you guys can provide.