(stupid) Example:
int addsub10(bool add, int val)
{
static int callcount = false; <-- cannot see in watch/mouseover
callcount++;
if(add)
{
int foo = val + 10; <-- cannot see in watch/mouseover return foo;
}
else
{
int bar = val - 10; <-- cannot see in watch/mouseover return bar;
}
}If I remove 'static' from the first line of addsub10 then I can see the values of callcount, foo and bar.
Quentin.
PS> A quick google search uncovers a thread with similar issues, but it's not found:
http://forums.microsoft.com/MSDN/Msgs/default.aspx MessageID=60567&SiteID=1
but the google cache version still exists:
http://72.14.253.104/search q=cache:fK45dO3PuwQJ:forums.microsoft.com/MSDN/ShowPost.aspx%3FPostID%3D797164%26SiteID%3D1+watch+static+2005&hl=en&ct=clnk&cd=1
What happened to the original thread

How to watch a static variable of method in debugger?
blex
Sorry to reopen an antique thread, but this is still a problem and I can't find a solution anywhere. So is there a fix yet It's an enormous pain in the ***. If I wanted to write a pile of debugging lines to get some insight into what my code is doing, I wouldn't need this elaborate debugger in the first place.kayers
Mattj1990
Santhosh S
I'm trying to repro this issue just now
John
AndrewAPlus
I think this could be a problem with VC++6's program database files, try deleting all intermidiate files (along with .NCB, .CLW) and see if problem goes away.
Hans L
Bruno VB Express Discover
Angry Coder
I stumbled across the following somewhere. Use sp5 and also install the processor pack for sp5. This fixes the problem, but sp5 has some bugs too. The one that I have run into is sscanf, don't use it with sp5! If I find where where I read this I'll post that too. (And where to find the service/processor packs)
TheViewMaster
Ok, Now that I'm back at work, here's what I've done. This has allowed my team to see static variables in the debugger. The trick was a post from another site, which someone in our group found.
"Visual C++ 6.0, which includes MFC 6.0, was released in 1998, was (and still is) widely used for large and small projects. There are however issues with this version under Windows XP, especially under the debugging mode (ex: the values of static variables do not display). The debugging issues can be solved with a patch called the "Visual C++ 6.0 Processor Pack" downloadable from http://msdn2.microsoft.com/en-us/vstudio/aa718349.aspx; curiously, this page stresses that Users must also be running Windows 98, Windows NT 4.0, or Windows 2000."
The processor pack requires you to be running on Visual Studio service pack 5. You can get that from Microsoft too.
http://msdn2.microsoft.com/en-us/vstudio/aa718363.aspx
Once both of these are installed you can see static variables declared within a function! But, like I stated earlier sp5 has its bugs too. You should review the sp6 release notes to see what changed after 5 was released.
Steve
jcnconnect
I believe the post was deleted due to no reply from the original poster.
Thanks, Ayman Shoukry VC++ Team