Game works when built in the IDE, but crashes when I run it from the .exe file.

Started by
40 comments, last by JohnnyCode 7 years, 7 months ago

Application Current Directory?

An exe run/debugged from IDE will set the current directory of application explicitly, and it may be any that your IDE implicitly decides.

Yet if your program starts manualy as is, it uses the exe location as application current directory- unless your program states otherwise.

Considering you do not use absolute file paths (and yes, you should not), and that you blow on file reads, that perhaps do not check and you blow some memory pointer afterwards, I am pretty sure it is that issue.

You can set current directory of aplication any time, or you can dynamicly construct your file paths from some observed constants like:

EXELOCATIONONHOST+CONSTANTSTRINGTORESOURCE

Advertisement

You can use this function to observe current directory at any point in program.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa364934(v=vs.85).aspx

I would also search code for possible calls to SetCurrentDirectory, sine it is a global setting that is perservering after it's called, when used not carefully, it can crash applications up.

This topic is closed to new replies.

Advertisement