CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    18

    Urjent... Unknown union member causes Unhandled exception...Help..

    Hi all,
    In my application I have a structure like this.

    typedef struct
    {
    DWORD msgType;
    PARAMS params;
    }MSGQ;


    typedef union //params
    {
    NEGOTIATE negotiate;
    CLOSELINE lineClose;
    LINEOPEN lineOpen;
    .
    .
    //etc
    } PARAMS;

    typedef struct
    {
    DWORD lineAddrID;
    int retVal;
    int FSMState;
    }LINEOPEN, CLOSELINE, NEGOTIATE;

    But when I create an objec of my structure MSGQ
    MSGQ msg;

    while the debugger(VC++5.0) runs, I put a breakpoint and found the value of msg.params.lineOpen .... Surprisingly the member of the union name was shown as "lineOpenA" instead of "lineOpen".
    and when the application exits it gives Unhandled exeption.
    All other members of union PARAMS are displayed correctly in the watch window, except the member "lineOpen".
    Can anybody tell me a way out.
    thanks in advance.
    bsmanoj


  2. #2
    Join Date
    Apr 1999
    Posts
    383

    Re: Urjent... Unknown union member causes Unhandled exception...Help..

    It looks as if you have a name clash. lineOpen is defined in Tapi.h as lineOpenA:

    Include\TAPI.H(3319):#define lineOpen lineOpenA

    Either change your naming convention, or put your names in your own namespace. Using your own namespace will ensure these name conflict problems do not arise.

    Dave



  3. #3
    Join Date
    Apr 1999
    Posts
    18

    Re: Urjent... Unknown union member causes Unhandled exception...Help..

    Dear Dave,
    Thanks a lot.
    bsmanoj.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured