Left side of '->' requires a pointer to class; type found was Structure

A

Amit_Basnak

Dear Friends

I have been getting the following error
Error 185: "WorkFlow_dce.cpp", line 58 # Left side of '->' requires a
pointer to class; type found was 'struct WF_SEARCH_WU'.
lclStruct->wfWuHandle.workunitId =(long) feStruct->wfWuHandle-
workunitId;

^^^^^^^^
Error 185: "WorkFlow_dce.cpp", line 59 # Left side of '->' requires a
pointer to class; type found was 'struct WF_SEARCH_WU'.
lclStruct->wfWuHandle.workunitSeq = (int)feStruct-
wfWuHandle->workunitSeq;

^^^^^^^^
Error 185: "WorkFlow_dce.cpp", line 60 # Left side of '->' requires a
pointer to class; type found was 'struct WF_SEARCH_WU'.
lclStruct->wfWuHandle.updateSerialNum = (int)feStruct-
wfWuHandle->updateSerialNum;

^^^^^^^^
Error 185: "WorkFlow_dce.cpp", line 61 # Left side of '->' requires a
pointer to class; type found was 'struct WF_SEARCH_WU'.
strcpy((char*)lclStruct->prodType,(char*)feStruct-
prodType.c_str());

^^^^^^^^
Error 185: "WorkFlow_dce.cpp", line 62 # Left side of '->' requires a
pointer to class; type found was 'struct WF_SEARCH_WU'.
strcpy((char*)lclStruct->prodSubType,(char*)feStruct-
prodSubType.c_str());

^^^^^^^^
Error 185: "WorkFlow_dce.cpp", line 63 # Left side of '->' requires a
pointer to class; type found was 'struct WF_SEARCH_WU'.
strcpy((char*)lclStruct->opnType,(char*)feStruct-
opnType.c_str());

^^^^^^^^
Error 185: "WorkFlow_dce.cpp", line 64 # Left side of '->' requires a
pointer to class; type found was 'struct WF_SEARCH_WU'.
strcpy((char*)lclStruct->customerNum,(char*)feStruct-
customerNum.c_str());

^^^^^^^^

In my WorkFlow_dce.cpp file
In funtion definition of fillWfSearchStructure I have
void fillWfSearchStructure(WF_SEARCH_WU *lclStruct ,WfSearchWu
&feStruct)
{
lclStruct->wfWuHandle.workunitId =(long) feStruct->wfWuHandle-
workunitId;
lclStruct->wfWuHandle.workunitSeq = (int)feStruct->wfWuHandle-
workunitSeq;
lclStruct->wfWuHandle.updateSerialNum = (int)feStruct->wfWuHandle-
updateSerialNum; strcpy((char*)lclStruct->prodType,(char*)feStruct->prodType.c_str());
strcpy((char*)lclStruct->prodSubType,(char*)feStruct-
strcpy((char*)lclStruct->opnType,(char*)feStruct->opnType.c_str());
strcpy((char*)lclStruct->customerNum,(char*)feStruct-
customerNum.c_str());
}

---------------------------------------------------------------------------------------------------------------------------------------
in WorkFlow_dce.h

The declaration of structure WF_SEARCH_WU
is

typedef struct
{
WF_WU_HANDLE wfWuHandle; // workunit handle structure
char prodType[4]; // [4]
char prodSubType[4]; // [4]
char opnType[7]; // [7]
char customerNum[11]; // [11]
}WF_SEARCH_WU;

Also the function declaration in the same file is as below
typedef WF_SEARCH_WU WfSearchWu;
void fillWfSearchStructure( WF_SEARCH_WU *lclStruct ,WfSearchWu
&feStruct );

Why would I get the above errors

Can someone please guide me in the right direction

Thanks
Amit
 
O

Ondra Holub

Amit_Basnak napsal:
Dear Friends

I have been getting the following error
Error 185: "WorkFlow_dce.cpp", line 58 # Left side of '->' requires a
pointer to class; type found was 'struct WF_SEARCH_WU'.
lclStruct->wfWuHandle.workunitId =(long) feStruct->wfWuHandle-

---------------------------------------------------------------------------------------------------------------------------------------
in WorkFlow_dce.h

The declaration of structure WF_SEARCH_WU
is

typedef struct
{
WF_WU_HANDLE wfWuHandle; // workunit handle structure
char prodType[4]; // [4]
char prodSubType[4]; // [4]
char opnType[7]; // [7]
char customerNum[11]; // [11]
}WF_SEARCH_WU;

Also the function declaration in the same file is as below
typedef WF_SEARCH_WU WfSearchWu;
void fillWfSearchStructure( WF_SEARCH_WU *lclStruct ,WfSearchWu
&feStruct );

Why would I get the above errors

Can someone please guide me in the right direction

Thanks
Amit

You can access members of struct with operator . (DOT) if you have
instance of this struct. You can use operator -> if you have pointer
to instance of struct or if you have defined overloaded operator-> for
this structure.
 
?

=?iso-8859-1?q?Erik_Wikstr=F6m?=

Dear Friends

I have been getting the following error
Error 185: "WorkFlow_dce.cpp", line 58 # Left side of '->' requires a
pointer to class; type found was 'struct WF_SEARCH_WU'.
lclStruct->wfWuHandle.workunitId =(long) feStruct->wfWuHandle-

The error is quite clear, you are trying to use something as if it
were a pointer while it's not.
In my WorkFlow_dce.cpp file
In funtion definition of fillWfSearchStructure I have
void fillWfSearchStructure(WF_SEARCH_WU *lclStruct ,WfSearchWu
&feStruct)

I'm not sure, the error-message got line-wrapped so it's hard to tell
what it's pointing to but it seems to me like the parameter feStruct
is passed as a WfSearchWu-reference but you are trying to use it as if
it were a WfSearchWu-pointer. Either change the type of the parameter
of replace the '->' with a '.'.
 
G

Grizlyk

Amit_Basnak said:
typedef WF_SEARCH_WU WfSearchWu;

void fillWfSearchStructure(
WF_SEARCH_WU *lclStruct ,
WfSearchWu &feStruct
)
{
lclStruct->wfWuHandle.workunitId =
(long) feStruct->wfWuHandle->workunitId;

"feStruct" you have declared as reference "WfSearchWu& feStruct", not
as pointer, and class WfSearchWu has no overloaded "operator->". Write
operator point "." instead of "->"
 
V

Victor Bazarov

Amit_Basnak said:
I have been getting the following error
Error 185: "WorkFlow_dce.cpp", line 58 # Left side of '->' requires a
pointer to class; type found was 'struct WF_SEARCH_WU'.
lclStruct->wfWuHandle.workunitId =(long) feStruct->wfWuHandle-
workunitId;

[..]

In my WorkFlow_dce.cpp file
In funtion definition of fillWfSearchStructure I have
void fillWfSearchStructure(WF_SEARCH_WU *lclStruct ,WfSearchWu
&feStruct)
{
lclStruct->wfWuHandle.workunitId =(long) feStruct->wfWuHandle-
workunitId;

Since 'feStruct' is a _reference_ to a 'WfSearchWu' objects, you must
use '.' to access its members.

V
 
A

Amit_Basnak

Amit_Basnak said:
I have been getting the following error
Error 185: "WorkFlow_dce.cpp", line 58 # Left side of '->' requires a
pointer to class; type found was 'struct WF_SEARCH_WU'.
lclStruct->wfWuHandle.workunitId =(long) feStruct->wfWuHandle-
workunitId;

In my WorkFlow_dce.cpp file
In funtion definition of fillWfSearchStructure I have
void fillWfSearchStructure(WF_SEARCH_WU *lclStruct ,WfSearchWu
&feStruct)
{
lclStruct->wfWuHandle.workunitId =(long) feStruct->wfWuHandle-
workunitId;

Since 'feStruct' is a _reference_ to a 'WfSearchWu' objects, you must
use '.' to access its members.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask- Hide quoted text -

- Show quoted text -

Thank you all for pointing out the cause of the error . The Error got
resolved with the desired changes.
Thank you all foryour help and time devoted to this.
Amit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,434
Messages
2,571,690
Members
48,796
Latest member
Greg L.

Latest Threads

Top