Microsoft KB Archive/115322

{|
 * width="100%"|

BUG: Debugger Can't Watch Static Member in Static Function

 * }

Q115322

1.00 1.50 WINDOWS kbtool kbbuglist -- The information in this article applies to: - The Visual Workbench Integrated Debugger included with: Microsoft Visual C++ for Windows, versions 1.0 and 1.5 - Microsoft CodeView for MS-DOS, versions 4.0, 4.01, and 4.1 - Microsoft CodeView for Windows, versions 4.0, 4.01, and 4.1 -- SYMPTOMS ======== If you watch a static member of a class in CodeView or the Visual WorkBench debugger from within a static member function of the class by placing a watch on the variable name or classname::member, the debugger will either display the error: CXX0030: Error: expression cannot be evaluated -or- CXX0017 Error: symbol not found RESOLUTION ========== You can work around the problem by setting a watch on an instance of the class. See the sample code in the "More Information" section of this article. STATUS ====== Microsoft has confirmed this to be a bug in the products listed above. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. The problem does not occur in Visual WorkBench 32-bit Edition, versions 1.1 or 2.0. MORE INFORMATION ================ In order to see this problem, build and debug the following sample code. You cannot watch sInt in the debugger by placing a watch on sInt or CSCMember::sInt. However, sInt can be viewed by putting a watch on scmemGlobal. Sample Code --- /* Compile options needed: /Zi /Od */ #include class CSCMember { public: static int sInt; const int cInt; public: CSCMember : cInt(4) {}; static void CSCMember::staticFunc { sInt++; } }; int CSCMember::sInt = 3; CSCMember scmemGlobal; void main  { /* CSCMember and CSCMember::sInt can be watched from here. */ printf ("static member= %d\n", scmemGlobal.sInt); printf ("const member= %d\n", scmemGlobal.cInt); scmemGlobal.staticFunc; } Additional reference words: 4.00 4.01 4.10 1.00 1.50 KBCategory: kbtool kbbuglist KBSubcategory: WBDebug CvwIss

Keywords : kb16bitonly

Issue type :

Technology :