0

I just installed SFML packages using NuGET Package Manager. After installing it. I ran a basic program from its official page. Just copy and paste.

#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;
}

When I run this i get LNK 2001 error. Stating Unresolved External Symbol.

My Own TRY

I searched on google and found that the problem is it with the lib files. I found the files in the package folder, none of them are listed on the tools, Project->Properties.

Tried adding SFML_DYNAMIC, didn't work;

Kishan Kumar
  • 302
  • 8
  • 19

1 Answers1

1

You need to add appropriate libs to linker dependencies in your project. Add library name(s) to Project->Properties->Linker->Input->Additional Dependencies.

Here is SFML tutorial on configuring Visual Studio project.

Paul
  • 13,042
  • 3
  • 41
  • 59
  • Now it says cannot open sfml-graphics.lib, then tried sfml-graphics-d.lib, then tried -s and then -s-d.lib. None of them worked – Kishan Kumar Dec 08 '15 at 17:28
  • And i'm not considering installing SFML to my system. I only want to install it to this project. – Kishan Kumar Dec 08 '15 at 17:30
  • If it can't find the libraries you also need to specify path to the libraries to Linker->General->Additional Library Directories. – Paul Dec 08 '15 at 17:38
  • did that too.That way works well when i install SFML by myself. But with NuGet it installs all the SFML in different directories – Kishan Kumar Dec 08 '15 at 17:40