SFML community forums

Help => General => Topic started by: game_maker on July 21, 2012, 12:30:02 am

Title: Errors while loading external resources
Post by: game_maker 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
Title: Re: Errors while loading external resources
Post by: eXpl0it3r 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).
Title: Re: Errors while loading external resources
Post by: game_maker on July 21, 2012, 01:13:09 am
I am using Visual C++ 2008 Express.
Thanks.
I will test what you said.

Edit

Perfect.