Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: What is wrong with examples in Source SFML?  (Read 1078 times)

0 Members and 1 Guest are viewing this topic.

abcnb

  • Newbie
  • *
  • Posts: 12
    • View Profile
What is wrong with examples in Source SFML?
« on: October 13, 2022, 06:07:35 pm »
Sorry for wall of text. I want to run pong example project from SFML .sln project.

Please, I really tried many times, but cannot understand what is wrong with https://www.sfml-dev.org/files/SFML-2.5.1-sources.zip.

My staff:

win10, CMake 3.2.2.1, MSVC 17.35 (2022), SFML 2.5.1.

My steps:

Downloaded sources.

Fed them to the CMake.
CMAKE_BUILD_TYPE: Release (ignored it due to https://www.sfml-dev.org/tutorials/2.5/compile-with-cmake.php).
SFML_BUILD_EXAMPLES: yes.
Other options left by default.
Configure, generate.

Opened MSVC.
Left all project settings by default.
Built ALL_BUILD Debug and Release.
Went to Common properties, set startup project, Current selection, select pong project.

I tried to RUN pong debug version and got "missed sfml-window-d-2.dll" and audio, graphics, system.
I tried to run pong release version and got the same, but  sfml-window-2.dll.

What is wrong? All settings in project look correctly! C/C++ and Linker nodes look correctly! They lead to sfmlb\lib\Debug and sfmlb\lib\Release respectively to Debug and Release configuration ( https://www.sfml-dev.org/tutorials/2.5/start-vc.php#top:-X

Of course, if I manually add these .dll in pong/debug and pong/release (and supplied with correspond resource folder) - it works! But indeed - it is bad manually solution.



eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: What is wrong with examples in Source SFML?
« Reply #1 on: October 14, 2022, 12:46:51 pm »
Windows doesn't support something like RPATH, so you have no other choice than to copy the DLLs next to the examples. Doing so automatically far all 13+ examples would create a lot of DLL copies in each example.
So yes, the only solution is to manually copy the DLLs to where you want to use them.

The other alternative would be to link statically, so the library is directly linked into the executables (except for the OpenAL DLL).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/