Linking CMake project with SFML in Visual Studio Code

  c++, cmake, sfml, windows

I’m using Visual Studio Code and Windows. How should i link my CMake C++ project with SFML library? I tried this:

add_executable(testsfml main.cpp)

target_link_libraries(testsfml sfml-graphics sfml-window sfml-system)

But it doesn’t really work. I get this ERROR:

[build] LINK : fatal error LNK1104: cannot open file 'sfml-graphics.lib' [E:DevelopingLearningTemp project for lessonssfml cmakebuildtestsfml.vcxproj]
[build] Build finished with exit code 1

How can i fix it? What should i do?

Source: Windows Questions

LEAVE A COMMENT