• Advertisement
Sign in to follow this  

msvc debugger

This topic is 4216 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

when running my program through the debugger, it will throw and error but loading a file, but not when running from explorer. what do ihave to do?

Share this post


Link to post
Share on other sites
Advertisement
ide provides default values and exception handlers

initialize all variables especially pointers

Kuphryn

Share this post


Link to post
Share on other sites
sorry, i made a typo earlier, what i ment was when it try to load a file it can't find it and exits but can when run the explorer.
sorry if i was unclear

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The program working directory is probably another one when you run it from the debugger.

Share this post


Link to post
Share on other sites
Its in the project options under debugging. Set it to the same directory that the exe is in.

Share this post


Link to post
Share on other sites
When you run the program from the IDE, the working directly is set to your project directory, which is usually the folder containing the debug and release folders. When you run the program from explorer, the working directory is set to the current directory.

You can change the working directory in the IDE by going to project settings -> Debugging and changing the "Working Directory" there.
Alternatively, load all your resources using absolute paths instead of relative paths (E.g. "C:\folder\app\data\blah.txt" instead of "data\blah.txt"). You can use GetModuleFileName() to get the filename of your exe, and strip the filename to get the path to your exe.

Quote:
Original post by kuphryn
ide provides default values and exception handlers
Just to nitpick: The compiler in debug mode sets the default values, not the IDE. The default values are supposed to be gibberish (At least, a recognisable pattern), so you can notice uninitialized variables. If he runs the debug exe from explorer, the variables will be initialized the same.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement