views:

1003

answers:

4

I just want to step through my program with Visual Studio 2005, but when I try to copy what my teacher (kinda) showed me, I start stepping through some other files that spontaneously appear in my window. They're called random things like "xstring" and "ios" and I'm really frustrated. Please, how do I step through my code?

A: 

http://mark.michaelis.net/Blog/VisualStudioKeyboardShortcutsWrapupMSDNFlashFeb22009.aspx

Basically speaking you should use F10(step-over) and not F11(step-in) when current line of code contains call to not your function.

Alex Reitbort
I tried! That does strange things!
+1  A: 

Most likely what's happening is that you're stepping into built-in methods in the framework. When that happens, just click "step out" and you'll be back in your own code.

You can also use "step over" for those methods that you know are built in - of course risking to step over methods you want to step into.

My recommendation is that you make sure to place breakpoints at every line where you want to check the state of the application - that way you can just use the play button (F5).

Tomas Lycken
+4  A: 

Why it's happening: you're using objects from the Standard Template Library. Some of your statements are explicitly or implicitly invoking methods of these STL classes. You're stepping into these methods with your debugger.

There are two ways to fix this:

  • If you know that you're on a statment which invokes an STL method, then choose the debugger's "Step Over" (F10) command instead of its "Step Into" (F11) command.

  • If you get into one of these methods by mistake, then use the debugger's "Step Out" (Shift-F11) command.

ChrisW
I'm trying to test what values are being assigned to variables in a section, and I seem to be stepping into these STL methods there... and I'm too much of a beginner to understand what's going on.
As a work-around, use "Step Out" (Shift-F11) if you do get into one of these methods. If it's any consolation, this is a bit of a well-known problem (i.e. it's not just you).
ChrisW
A: 

The best way to avoid stepping into such methods is to set NoStepInto rules in the registry. Check out this blog post for exactly how to do it.

If you want to avoid the whole of the standard library, just set the following rule:

10    std\:\:.*=NoStepInto

For Visual Studio 2005 you need to add the rule to the following key

HKLM\Software\Microsoft\VisualStudio\8.0\NativeDE\StepOver

Vickster