FIX: Cannot Evaluate Structures in Classes

ID: Q143050


The information in this article applies to:
  • The debugger
    • Microsoft Visual C++ 32-bit Edition, version 4.0


SYMPTOMS

The Visual C++ version 4.0 debugger cannot evaluate structures that are defined and declared inside a class when C7-compatible debugging information is generated.

In the Auto window you will get this error:

CXX0030: Error: expression cannot be evaluated.
In the QuickWatch window you will get this error:
CXX0017: Error: symbol "CMyClass::MyStruct" not found.


RESOLUTION

Use the /Zi compiler switch (Program Database) or make the structure definition global.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ 4.1.


MORE INFORMATION

Sample Code to Reproduce Problem


/* Compile options needed: /Z7
*/ 
#include <string.h>

class CMyClass
{
    int myInt;

    struct MyStruct
    {
        char string[30];
    };
    MyStruct myStruct;
public:
    CMyClass()
    {
        myInt = 5;
        strcpy(myStruct.string, "Hello");
    }   // Set Break Point here
};


void main()
{
    CMyClass c;
} 

Additional query words: kbVC400bug 4.00 4.10

Keywords : kbDebug kbide kbVC410fix
Version :
Platform : NT WINDOWS
Issue type :


Last Reviewed: January 20, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.