debug exe in IDE vs outside IDE

C++ console application in Visual Studio 2005.
Debug build runs fine from inside the IDE. When debug build is run outside the IDE it returns error codes and terminates.
Same exe, right? Why would this be?
[222 byte] By [majoob] at [2007-11-20 11:49:21]
# 1 Re: debug exe in IDE vs outside IDE
Perhaps, your exe needs something that not exists outside the IDE?
VictorN at 2007-11-11 4:02:40 >
# 2 Re: debug exe in IDE vs outside IDE
Is you PATH set correctly? IIRC, you can set/add to the PATH from within the IDE.

Viggy
MrViggy at 2007-11-11 4:03:43 >
# 3 Re: debug exe in IDE vs outside IDE
Let me clarify a little:
This program exercises and tests database operations, checking return values for accuracy. It's not accessing a separate database file... the test program does everything in memory.

The debug version run from within the IDE successfully completes all tests and finishes without errors.

The debug version run stand-alone (outside the IDE) gets through about 2/3 of the database tests then fails and terminates.

I can understand differences between debug and release, but this is debug vs debug, again same exe, same binary, same instruction set.
majoob at 2007-11-11 4:04:41 >
# 4 Re: debug exe in IDE vs outside IDE
Let me clarify a little:
This program exercises and tests database operations, checking return values for accuracy. It's not accessing a separate database file... Well, then where does the database exist? :confused:
VictorN at 2007-11-11 4:05:46 >
# 5 Re: debug exe in IDE vs outside IDE
One difference between running the exe from within the IDE and without is, that IDE sets the current directory of the exe to the project folder (where you have all those cpp & h files) and running the exe normally (e.g. double-click) the current directory is the current directory :). This can have some unsuspected effects if you are using relative paths like

CString StrFilePath = _T(".\\my_file.xml");

Hope this helps,
Regards,
Usman.
usman999_1 at 2007-11-11 4:06:53 >
# 6 Re: debug exe in IDE vs outside IDE
I'd tend to suspect a memory allocation problem since memory allocation is probably subtlely different when running in the debugger. Can't be more specific though, I'm afraid.
John E at 2007-11-11 4:07:50 >
# 7 Re: debug exe in IDE vs outside IDE
The debug version run from within the IDE successfully completes all tests and finishes without errors.

The debug version run stand-alone (outside the IDE) gets through about 2/3 of the database tests then fails and terminates.Your application has a bug, plain and simple.

"My app works on one machine, but not another"
"My app works when I uninstall <whatever>, but not otherwise"
"My app worked yesterday, but today it crashes".

etc...etc...

Your situation is just a variation on the same theme. You run it in one environment, works, another environment doesn't work.

This sounds like a memory overwrite in your application, or some other issue that isn't obvious (threading maybe?). But the bottom line is that your situation is not unique, as it happens to every programmer at some point.

Regards,

Paul McKenzie
Paul McKenzie at 2007-11-11 4:08:54 >