Stefan
Stefan

Reputation: 3869

unidentified struct _WS_ERROR

I am setting up a web service in C++ using the WSUtil.

I have run the utility on my code and have the generated files. When I try to build the exe I get the build error:

'theerror' uses undefined struct '_WS_ERROR'

from the line:

WS_ERROR theerror;

In WebServices.h

typedef struct _WS_ERROR WS_ERROR;

But the definition of _WS_ERROR seems to be causing an issue. Has anyone had this issue or have any advice on how to find the definition of _WS_ERROR?

Upvotes: 0

Views: 212

Answers (1)

user4462979
user4462979

Reputation: 36

This is an old question, but just in case the answer helps someone else:

You aren't supposed to create an WS_ERROR instance yourself. You should have it allocated for you via WsCreateError.

So:

WS_ERROR theerror;

Should instead be:

WS_ERROR *theError;
HRESULT hr = WsCreateError(NULL, 0, &theError); 
if (FAILED(hr)) { 
 // do appropriate error handling here 
}

Don't forget when you are done to:

if (theError)
{
  WsFreeError(theError);
}

Upvotes: 1

Related Questions