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

Discussion in 'C++' started by Amit_Basnak, Feb 1, 2007.

  1. Amit_Basnak

    Amit_Basnak Guest

    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-
    >prodSubType.c_str());

    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
     
    Amit_Basnak, Feb 1, 2007
    #1
    1. Advertising

  2. Amit_Basnak

    Ondra Holub Guest

    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-
    > >workunitId;

    >


    ---------------------------------------------------------------------------------------------------------------------------------------
    > 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.
     
    Ondra Holub, Feb 1, 2007
    #2
    1. Advertising

  3. On Feb 1, 4:13 pm, "Amit_Basnak" <> wrote:
    > 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 '.'.

    --
    Erik Wikström
     
    =?iso-8859-1?q?Erik_Wikstr=F6m?=, Feb 1, 2007
    #3
  4. Amit_Basnak

    Grizlyk Guest

    Amit_Basnak wrote:
    >
    >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 "->"

    > lclStruct->wfWuHandle.workunitId =
    > (long) feStruct.wfWuHandle->workunitId;


    --
    Maksim A Polyanin
     
    Grizlyk, Feb 1, 2007
    #4
  5. Amit_Basnak wrote:
    > 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
     
    Victor Bazarov, Feb 1, 2007
    #5
  6. Amit_Basnak

    Amit_Basnak Guest

    On Feb 1, 8:30 pm, "Victor Bazarov" <> wrote:
    > Amit_Basnak wrote:
    > > 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
     
    Amit_Basnak, Feb 2, 2007
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. imranzafar
    Replies:
    5
    Views:
    2,400
    Default User
    Aug 12, 2005
  2. =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=

    Help on table align on left of page vs left hanging indent

    =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=, Jul 10, 2007, in forum: XML
    Replies:
    2
    Views:
    1,047
    =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=
    Jul 16, 2007
  3. pc
    Replies:
    2
    Views:
    1,391
    crisgoogle
    Jun 8, 2011
  4. lawrence
    Replies:
    13
    Views:
    341
    Thomas 'PointedEars' Lahn
    Sep 4, 2004
  5. Victor Hooi
    Replies:
    4
    Views:
    363
Loading...

Share This Page