I've been messing about with the SFML 1.6 libraries lately and very much enjoying the process. I started on the Displaying Text tutorial and was let down when, after following all the rules and guidelines set by the tutorials, I got linker errors:
1>main.obj : error LNK2001: unresolved external symbol "private: static unsigned int * sf::Font::ourDefaultCharset" (?ourDefaultCharset@Font@sf@@0PAIA)
The full source code to my project is as follows:
#include <SFML/Graphics.hpp> //Contains Graphics and Window stuff!
//We need to define SFML_DYNAMIC in order to use the dynamic libraries
#define SFML_DYNAMIC
int main()
{
//Creates a window, pretty simple
sf::RenderWindow app(sf::VideoMode(800, 600, 32), "SFML Window");
//Open a sprite
sf::Image image;
image.LoadFromFile("media/sprite/sprite.jpg");
sf::Sprite sprite;
sprite.SetImage(image);
sprite.SetColor(sf::Color(0, 255, 255, 128));
sprite.SetX(100.f);
sprite.SetY(200.f);
sprite.SetPosition(200.f, 100.f);
sprite.SetRotation(30.f);
sprite.SetCenter(0, 0);
sprite.SetScaleX(0.75f);
sprite.SetScaleY(0.75f);
sprite.SetBlendMode(sf::Blend::Multiply);
sprite.Move(10.f, 5.f);
sprite.Rotate(15);
sprite.Scale(1.5f, 1.5f);
//Create a view
sf::View view(sf::FloatRect(0, 0, 800, 600));
view.Zoom(2.f);
app.SetView(view);
//Create a font
sf::Font font;
font.LoadFromFile("media/font/Arial.ttf", 50);
//Create text
sf::String text("Beard Hole!", font, 50);
text.SetPosition(10.f, 500.f);
//The main loop checks if the window is still open!
while (app.IsOpened())
{
sf::Event msg; //Define an event
while (app.GetEvent(msg))
{
if (msg.Type == sf::Event::Closed)
app.Close();
}
app.Clear(sf::Color(0, 100, 200));
app.Draw(sprite);
app.Draw(text);
app.Display();
}
return EXIT_SUCCESS;
}
As you can see, I've defined SFML_DYNAMIC, I'm using the dynamic libraries and they're in the directory of my debug executable (The debug versions of course :v), I've linked the libraries etc.. Everything is all set and yet I'm still unable to use text, which is quite a big deal for me right now
Does anyone have a solution? Oh and I'm compiling in VS2008, no problems other than this.