This has most likely to do with the working directory. If you double click an executable in Explorer, the working directory is the same location as the folder the executable is inside.
If you launch an executable from its project in visual studio, the working directory is usually the folder that includes the project file.
In Visual Studio's project settings find "Debugging" and set the working directory to be the final location of the executable file. Then just debug as usual and you should be able to step through your code, trying to figure out what's wrong.