Summary: Getting Started with the Visual C++ Debugger
This tutorial discusses how Visual Studio 6.0's debugging tools can be used to find and fix
problems in C++ programs. It doesn't assume any experience with either debuggers or Visual
Studio's debugging tools. The debugger is a tool to help correct runtime and semantic errors --
note that no debugging tools are useful in solving compiler errors.
Compiler errors are those that show at the bottom of the screen when compiling. Things like
"V:\debugger\temp.cpp(11) : error C2146: syntax error :
missing ';' before identifier 'cin'" Since these are always associated
with a particular line of the program, they're generally fairly easy to solve.
The difficult problems are the ones that happen while the program is running. The syntax is
correct (or it wouldn't have compiled), so the error is that the code doesn't do what you think it
Basic Debugging Technique
If the program isn't working correctly, one of two things could be going wrong:
1) Data is corrupt somewhere. Was something added that should be subtracted? Is some user
input not being stored properly?
2) The code isn't correct . Are all the loop conditions set properly? Are the functions called in the
right order? Is there an if where there shouldn't be one?
The idea of debugging is to determine what line is causing the problem so the error can be more
easily identified. It's important to note that the line on which a problem evidences itself is not