msvc debugger
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?
ide provides default values and exception handlers
initialize all variables especially pointers
Kuphryn
initialize all variables especially pointers
Kuphryn
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
sorry if i was unclear
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.
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 kuphrynJust 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.
ide provides default values and exception handlers
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement