Is your working directory correct?
If you're using Visual Studio, for example, unless you have specified the working directory when you run your program by pressing the "debug" button it does not actually execute the program from your "Debug" folder. This could be a problem if you are referencing files in the same directory or using a relative path since they won't be found in the working directory.
In Visual Studio you can change your working directory for each configuration by going to Project > [project name] Properties... > Configuration Properties > Debugging > Working Directory.