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

Author Topic: SFML Game cannot run on another computer  (Read 2046 times)

0 Members and 2 Guests are viewing this topic.

bongobl

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
SFML Game cannot run on another computer
« on: November 25, 2014, 12:47:18 am »
Hi, I am new to the SFML forums so forgive me if I do not adequately present my issue clearly,

I wrote a simple game in SFML and it runs fine on my computer, but when I copy my game folder (includes game application called "Third.exe" and all required DLL's) to another computer, I get these error messages from the console whenever I run Third.exe:

**********************************************************************
D:\test-1>third
Failed to load image "C:/Users/Alex/Documents/Visual Studio 2012/Projects/Third/
Third/Resources/gunsight.png". Reason : Unable to open file
Failed to load image "C:/Users/Alex/Documents/Visual Studio 2012/Projects/Third/
Third/Resources/MainHUD.png". Reason : Unable to open file
Failed to load image "C:/Users/Alex/Documents/Visual Studio 2012/Projects/Third/
Third/Resources/Ammo/Ammo_0.png". Reason : Unable to open file
Failed to load image "C:/Users/Alex/Documents/Visual Studio 2012/Projects/Third/
Third/Resources/Ammo/Ammo_1.png". Reason : Unable to open file
Failed to load image "C:/Users/Alex/Documents/Visual Studio 2012/Projects/Third/
Third/Resources/Ammo/Ammo_2.png". Reason : Unable to open file
Failed to load image "C:/Users/Alex/Documents/Visual Studio 2012/Projects/Third/
Third/Resources/Ammo/Ammo_3.png". Reason : Unable to open file
Failed to load image "C:/Users/Alex/Documents/Visual Studio 2012/Projects/Third/
Third/Resources/Ammo/Ammo_4.png". Reason : Unable to open file
Failed to load image "C:/Users/Alex/Documents/Visual Studio 2012/Projects/Third/
Third/Resources/Ammo/Ammo_5.png". Reason : Unable to open file
Failed to open sound file "C:/Users/Alex/Documents/Visual Studio 2012/Projects/T
hird/Third/Resources/Sounds/Sniper_sound.ogg" (System error : The system cannot
find the path specified.
)
Failed to load image "C:/Users/Alex/Documents/Visual Studio 2012/Projects/Third/
Third/Resources/Enemy/enemy.png". Reason : Unable to open file
Failed to load image "C:/Users/Alex/Documents/Visual Studio 2012/Projects/Third/
Third/Resources/Enemy/enemy_dead.png". Reason : Unable to open file
Random Number: 2
Failed to load image "C:/Users/Alex/Documents/Visual Studio 2012/Projects/Third/
Third/Resources/Background.png". Reason : Unable to open file
********************************************************************

It seems that the resource files I used such as .png's, .ogg's cannot be found. The problem is that I didn't think these files were needed at runtime.
So my question is, what must I do to properly run the game on another computer? Do I need to statically compile, or include the resource files with the game, etc?
Any help would be appreciated.

-Alex 



Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: SFML Game cannot run on another computer
« Reply #1 on: November 25, 2014, 12:57:40 am »
You'll need to provide those resources since the program is trying to use the images.
Or, change the code to point to different images/resources.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: SFML Game cannot run on another computer
« Reply #2 on: November 25, 2014, 12:48:27 pm »
As Hapax said, the resources are needed at runtime, thus you need to ship them with your binary.
Also you should use relative paths for your resources. When running the executable it will look for them starting from the working directory. When starting from VS the working directory is the same as the one containing the project file.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

bongobl

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: SFML Game cannot run on another computer
« Reply #3 on: November 26, 2014, 04:41:59 am »
Thanks for the help, that fixed my problem!

 

anything