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

Author Topic: how to release SFML project?  (Read 1273 times)

0 Members and 1 Guest are viewing this topic.

mafiozy

  • Newbie
  • *
  • Posts: 3
    • View Profile
how to release SFML project?
« on: January 14, 2023, 04:24:16 pm »
hello everyone. I made my project, and trying to release it to send my friends. So program works when i load Debug folder with recourses and start exe from there, but doesnt work when i do the same but for Release folder. It says that it cannot load images and audios. What to do?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: how to release SFML project?
« Reply #1 on: January 16, 2023, 11:27:46 pm »
Depends on various variables. I'll assume you're using Windows to start with.

When you write sound.loadFromFile("resource/sound.wav"), then path the executable will try to load the files from, are relative to the working directory. When you double click the executable in explorer, the working directory is usually set to the same directory as the executable is in.
In short, you usually want the resources located relative to your executable.

Other than that, make sure to ship the necessary DLLs (don't forget OpenAL!) and if you're using Visual Studio, you may need to tell your friend to install the matching redistribution package to install the runtime libraries.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/