I have an SDL snake game that uses .png textures. I want to run it from Visual Studio 2012 to debug. The problem is, when I start it, it gives an 'Unhandled Exception' error when it tries to load that textures. Maybe the IDE runs the program from the wrong path? What can I do to fix it?
The problem is most likely with the path. It usually is.
The program will look for the file in the current working directory. If the current working directory is not the same directory as your .png is located it will not find it. If you start your program by double clicking on the executable file the current working directory will be the directory where the executable file is located. If you start your program from the command line the current working directory will be the directory that you set using the cd command. If you start your program from an IDE the current working directory is often set to the project directory (not the source directory) but this can differ between IDEs.