I'm trying to connect the sfml library to my VC++ project. I use VS15 , Release mode without using dll . I do everything in accordance with this official instruction http://www.sfml-dev.org/tutorials/2.4/start-vc.php for static linking. If I specify sfml-graphics-s.lib;sfml-window-s.lib;sfml-system-s.lib;opengl32.lib;freetype.lib;jpeg.lib;winmm.lib;gdi32.lib; in the "additional dependencies" sfml-graphics-s.lib;sfml-window-s.lib;sfml-system-s.lib;opengl32.lib;freetype.lib;jpeg.lib;winmm.lib;gdi32.lib; + inherited values, I get

Error LNK1181 cannot open input file "sfml-graphics-s.lib"

If you get into the lib folder and write the library names libsfml-graphics-sa , etc., directly in the dependencies, this error disappears and errors of unresolved external characters appear.

The main.cpp file from the tutorial

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

How can this be fixed?

  • SFML_STATIC added if anything - Sergey
  • libsfml-graphics-sa - I have a suspicion that * .a is not supported by the studio. - Vladimir Martyanov
  • @ Vladimir Martiyanov is possible, but with the canonical variant from the tutorial, i.e. sfml-graphics-s.lib file does not open - sfml-graphics-s.lib
  • one
    The lib, which is probably understood by the studio, is not, but there is .a, which the studio probably does not understand. That is the problem. - Vladimir Martyanov
  • one
    .a is for Linux, I .a . Or maybe for MinGW. Try to make sure that you download the binaries just for Visual Studio. - VladD

1 answer 1

Hello, it is worth noting that you only need to download the version of sfml that fits your Visual Studio and bit depth. I also used this instruction http://kychka-pc.ru/sfml/urok-1-podklyuchenie-biblioteki-k-srede-razrabotki-visual-studio-2013.html for quite a while, it worked and worked, although it was described using the example of VS 2013 and everything worked for me in debug (I just did not try relese). Yes, according to this source, the SFML_DYNAMIC was used in the definition of the preprocessor and also a number of dll libraries, which the author kindly provided.