FIX: Cannot Evaluate Structures in Classes

Last reviewed: September 19, 1997
Article ID: Q143050
4.00 WINDOWS NT kbtool kbbuglist kbfixlist

The information in this article applies to:

  • The debugger included with: 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 reference words: 4.00 4.10
KBCategory: kbtool kbbuglist kbfixlist
KBSubcategory: WBDebug vcbuglist400 vcfixlist410
Keywords : vcbuglist400 vcfixlist410 WBDebug kbbuglist kbfixlist kbtool
Version : 4.00
Platform : NT WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 19, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.