I met a problem using vs 2005

V

Vivienne

I am using vs 2005 on windows xp.
I created a project, named ssps.And when debugging, I set project
property->debugging->command argument the way I wanted,like this: -b f:
\files f:\files. Then I ran the program. Everything went all right,
and I got the exact result, and two files are successfully created at
\ssps\debug, where the executable file ssps.exe located.
when I finished debugging , I made the release version, so I got the
ssps.exe in the directory \ssps\release. when I try to test the
executable file using command line,like this: ssps.exe -b f:\files f:
\files, errors occured.It reads like, 0x78180469 command accessing
0x003b5000 memory, the memory can not be written.
I also tried to run the executable file in Debug directory, and got
the same problem.
Now I don't know what to do. Why everything is ok when debugging but
errors occured when using command line to run it? I won't meet the
problem when debugging, so I can't feagure out where is the problem.
Can someone help me to explain it? Or tell me what to do now?
 
?

=?iso-8859-1?q?Erik_Wikstr=F6m?=

I am using vs 2005 on windows xp.
I created a project, named ssps.And when debugging, I set project
property->debugging->command argument the way I wanted,like this: -b f:
\files f:\files. Then I ran the program. Everything went all right,
and I got the exact result, and two files are successfully created at
\ssps\debug, where the executable file ssps.exe located.
when I finished debugging , I made the release version, so I got the
ssps.exe in the directory \ssps\release. when I try to test the
executable file using command line,like this: ssps.exe -b f:\files f:
\files, errors occured.It reads like, 0x78180469 command accessing
0x003b5000 memory, the memory can not be written.
I also tried to run the executable file in Debug directory, and got
the same problem.
Now I don't know what to do. Why everything is ok when debugging but
errors occured when using command line to run it? I won't meet the
problem when debugging, so I can't feagure out where is the problem.
Can someone help me to explain it? Or tell me what to do now?

Are you playing around with pointers? If so make sure that they always
have a valid value. It's hard to say what's wrong but if the program
is small you could post it here and someone might spot it. If it's not
try to comment out/remove parts until either you find the problem or
the program is small enough to post here.
 
D

Daniel T.

Vivienne said:
Now I don't know what to do. Why everything is ok when debugging but
errors occured when using command line to run it? I won't meet the
problem when debugging, so I can't feagure out where is the problem.
Can someone help me to explain it? Or tell me what to do now?

The first thing you need to do is go through the entire program and make
sure that every pointer variable is initialized to 0. Then try to run it
in the debugger again and see what happens.

If the above doesn't help, then go through the entire program and check
every pointer dereference. Wherever you have "*ptr" or "ptr->" put an
assert before it that says "assert( ptr );" then run the program in the
debugger and see what happens.

If the above doesn't help, then go through the entire program and check
every array access. Wherever you have a "foo[bar]" put an assert before
it that says "assert( bar >= 0 && bar < num_elements_in_foo );" then run
the program in the debugger and see what happens.

Good luck.
 
E

Eberhard Schefold

Vivienne said:
when I finished debugging , I made the release version, so I got the
ssps.exe in the directory \ssps\release. when I try to test the
executable file using command line,like this: ssps.exe -b f:\files f:
\files, errors occured.It reads like, 0x78180469 command accessing
0x003b5000 memory, the memory can not be written.

You can build you Release executable with Debugging information
(Configuration Properties | Linker | Debugging). Make sure that
Just-In-Time Debugging is enabled (Tools | Options | Debugging).
Reproduce the crash. You should now be able to attach the debugger to
the process and perform any debugging action necessary. In particular
the Call Stack might be helpful for finding your problem. Just keep in
mind that optimizations have been done for the Release build, so you
can't necessarily see every variable or line of code in a 1:1 fashion.
 
E

Eberhard Schefold

Eberhard said:
You can build you Release executable with Debugging information [...]

Sorry, I forgot: What I wrote about debugging strategies in that
specific development environment is off-topic here. For that discussion
better go to a group in the microsoft.public hierarchy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top