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

Author Topic: Errors while loading external resources  (Read 1527 times)

0 Members and 1 Guest are viewing this topic.

game_maker

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • Email
Errors while loading external resources
« on: July 21, 2012, 12:30:02 am »
I don't know where to save the files, such as sprites and sounds.

If I save in the project folder, errors.
So I save in the Release folder too, no errors.

But, if I save only in the Release folder, errors.
So I save in the project folder too, no errors.

It only works if I save the files in both.

What is happening?

The Release folder is in the project folder, as it was meant to be.

Info:

Windows 7 Home Basic
4 GB ram
Core i5 2.4 GHz
HD Graphics 3000

Goodbye
« Last Edit: July 21, 2012, 12:32:14 am by game_maker »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: Errors while loading external resources
« Reply #1 on: July 21, 2012, 12:43:16 am »
I didn't quite get what the problem is, but I guess you mean that your application can't load the files because it doesn't find them. Also since you don't mention it, I'm going to assume that you're using Visual Studio.
Since VS seperates the Debug and Release builds in diffrent folders (to not overwrite the diffrent builds) it changes the working directory to the project folder i.e. where the *.vcxproj files is saved to. An application in Windows always searchs in the working directory for resources or dll first and then in the directories provided by the Windows enviroment variable PATH.
So the thing you have to do is put your resources/resource directory next to the *.vcxproj file (by default: ProjectName/ProjectName/*.vcxproj) and everything should work for Debug and Release. If it doesn't make sure you didn't change the settings for the working directory under Project->Settings->Debugging->Working Directory (or similar) there should be written $(ProjectDir).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

game_maker

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • Email
Re: Errors while loading external resources
« Reply #2 on: July 21, 2012, 01:13:09 am »
I am using Visual C++ 2008 Express.
Thanks.
I will test what you said.

Edit

Perfect.
« Last Edit: July 21, 2012, 03:49:21 pm by game_maker »