Issue with SFML

I have learned the basics of C++ console, and I wanted to move on to SFML to start creating games for practice. However, I came across an issue while installing.

When I try to run the test code (below), an error occurs with "LNK2001", an external symbol issue regarding the sf::Color and such. They are, apparently, two unresolved externals.

Any idea on how to fix this?
I've also double checked the libraries and directories that are supposed to be in place, and they seem okay.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "stdafx.h"
#include <SFML\Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        { 
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}
Last edited on
Hm, I thought I gave enough information regarding the issue, oh well. Here's the build output:

1
2
3
4
5
6
1
1>TEST.obj : error LNK2001: unresolved external symbol "public: static class sf::Color const sf::Color::Green" (?Green@Color@sf@@2V12@B)
1>TEST.obj : error LNK2001: unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)
1>C:\Users\<computer name>\Documents\Visual Studio 2012\Projects\TEST\Debug\TEST.exe : fatal error LNK1120: 2 unresolved externals
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(611,5): error MSB6006: "link.exe" exited with code 1120.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



So, what happens is the program does not compile and leaves me with this error.

Edit: I forgot to mention that I'm using SFML 2.1, if it matters at all.
Last edited on
You're not linking to the necessary libs. You have to link to the graphic lib.
I did that and I'm still getting the exact same two errors.
Topic archived. No new replies allowed.