PRB: Error CXX0017 or CXX0034 for typedef

Last reviewed: July 25, 1997
Article ID: Q119501
The information in this article applies to:
  • The Visual Workbench Integrated Debugger included with: - Microsoft Visual C++ 32-bit Edition, versions 1.0, 2.0, 2.1, 4.0, 5.0

SYMPTOMS

Declare a structure type and typedef a pointer to the structure type as follows:

   struct MYSTRUCT {
      int x;
      int y;
   };

   typedef struct MYSTRUCT* PMYSTRUCT;

MYSTRUCT is a structure type and PMYSTRUCT is a typedef for a pointer to MYSTRUCT. Declare and initialize the following variables:

   struct MYSTRUCT var1 = {0, 0};
   PMYSTRUCT var2 = &var1;

Putting a watch on "(PMYSTRUCT) &var2" produces the following error:

Visual C++ 1.0 and 4.0

   CXX0017: Error: symbol 'PMYSTRUCT' not found

Visual C++ 2.x

   CXX0034: Error: types incompatable with operator

However, putting a watch on "(MYSTRUCT *) &var2" is successful.

CAUSE

The typedef declares a new name for a type, but it does not define a new type. The typecast attempted in the debugger requires the name of a defined type.

RESOLUTION

Use the defined type in the typecast, rather than using the name declared with the typedef.

Keywords          : WBDebug
Version           : 1.0 2.0 2.1 4.0 5.0
Platform          : NT WINDOWS
Issue type        : kbprb


================================================================================


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: July 25, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.