954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How do I go about viewing static variables while debugging?

I'm using Visual Studio 6.0 for C++ and while I'm stepping through my code in Debug mode, I'm not able to view any of my static variables in the "Locals" section of the context window. I know there has to be a way to set this up, as the computers I use at my school allow for it.

Any ideas on how exactly I can set up my Debug mode so that I can view these?

PopnFresh
Newbie Poster
3 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

Add them to your watch list, or view them from the "Autos" section.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 
Add them to your watch list, or view them from the "Autos" section.

A solution this simple is kind of what I was afraid of. Maybe I turned something off by default in my compiler?

I can't add them to my watch list, because they're not in my context list. Notanywhere in my context list. Not in Autos, or Locals, or this. That is the base of my problem: I want them in the context list so I can add them to Watch.

The only way I can view the static variables now is by declaring new variables that constantly equal their value (the types in question are an int and character pointer). The issue here is I would have to do this EVERYWHERE in my code, which is just too much.

PopnFresh
Newbie Poster
3 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

>I want them in the context list so I can add them to Watch.
They don't have to be in your context list. Just type them into the watch list manually. For certain objects this will fail, but static or global objects will typically come up if you get the name right.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 
>I want them in the context list so I can add them to Watch. They don't have to be in your context list. Just type them into the watch list manually. For certain objects this will fail, but static or global objects will typically come up if you get the name right.

Beautiful. For some reason I feel like I tried doing that before, but obviously not. Thank you very much, El Lifesavero.

PopnFresh
Newbie Poster
3 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

I and others here are having the same problem (Visual C++ 6.0) and none of the solutions offered here have ever worked. If I type a static int (example "CMode") into a watch window I get "CX0017: Error: symbol "CMode" not found

mesmer
Newbie Poster
2 posts since Dec 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You