Click to See Complete Forum and Search --> : Urjent... Unknown union member causes Unhandled exception...Help..


bsmanoj
April 7th, 1999, 07:25 AM
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

Dave Lorde
April 7th, 1999, 08:37 AM
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

bsmanoj
April 7th, 1999, 09:05 AM
Dear Dave,
Thanks a lot.
bsmanoj.