Using execution file vs debug

The git hub for my project is: https://github.com/Doraonroids/Pucker

I'm using visual studio 2019. When I debug the code using VS it runs just fine. When I go to open the execution file everything works fine except I get an error for option 1. The error says:

"Debug Assertion Failed!
blah blah blah
vector subscript out of range"

I can probably find where I go out of range but the error only displaying when I run the exe file doesn't make sense to me. How come this error would appear when I open the executable but not when I used VS to debug?

I'd like a way to share just the executable and need files. So, I need it to work.
Didn't look very closely, but the first thing I see is that you don't do much checking when a file is opened. If you're opening a file, especially for input, you should check if it is opened correctly.
e..g
1
2
3
4
5
std::ifstream INF(filename);
if (!INF)
{
    std::cout << "ERROR " << filename << " DID NOT OPEN!\n";
}


If something works in Visual Studio, but not out of it (or vice versa), I assume this is because the working directories are different, and you are no longer able to locate files correctly in the program. Just a guess but it's what it sounds like.
Last edited on
^^ The above is a common issue as VS sets up paths for you when you run inside it but outside the paths still need to exist, and may not. You see this on dlls, files, and similar things that the program needs access to which are probably located in the project folder but not the exe's folder.

One way to fix it forever is to set up a new project template that puts the .exe back in the project folder instead of /other folders. This works as long as you don't need to hold onto debug builds when you start doing release builds ... if you need that you can rename the debug build one to name_d .exe or something to keep both.
Topic archived. No new replies allowed.