Thread: please help "error ,request for member ‘out’ in something not a structure or union "

  1. #1
    Registered User
    Join Date
    Sep 2013
    Posts
    7

    Question please help "error ,request for member ‘out’ in something not a structure or union "

    Hello

    if anyone can help me with this error in the last two lines of the "makeEdgeBetween2Nodes " function:
    error is " request for member ‘out’ in something not a structure or union "

    Code:
    typedef st_graphNode ;
    typedef struct st_edgeList 
    {
    double val;
    struct st_edgeList *next;
    //struct st_edgeList *previous;
    struct st_graphNode *node;
    }t_edgeList ;
    
    typedef struct st_graphNode 
    {
    int val;
    int additional ;
    struct st_graphNode *next;
    //struct st_graphNode *previous;
    t_edgeList *out;
    }t_graphNode;
    
    void makeEdgeBetween2Nodes(t_graphNode **node1,t_graphNode **node2 , t_edgeList **e)
    {
    inserEdge(&(*node1),&(*e));
    inserEdge(node2,e);
    
    ((node1)->out)->node=node2;
    ((node2)->out)->node=node1; 
    }
    

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    Welcome to the forum.

    See the arguments of makeEdgeBetween? The first two are of double pointers.

    Recall that the arrow sign means this (*node).out

    Can you give it another shot now?
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  3. #3
    Registered User
    Join Date
    Sep 2013
    Posts
    7

    so ,my last tow lines should be like this , shouldn't it ?

    [CODE]
    ((*node1)->out)->node=&(node2);
    ((*node2)->out)->node=&(node1);
    [C/ODE]

    the previous error disappeared but now I have some thing different " look at the image "
    I will try using gdb for it

    -screenshot-2013-09-05-00-58-39-png

  4. #4
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    I can't tell from the code you provided, which is the error.

    Meanwhile, take a look in indenting your code.

    Also, I would like to remind you how typedef works. We have typedef A B. Now A and B are synonymous, thus they mean the same thing.
    For example,
    Code:
    typedef struct node node
    allows us to write just node, instead of struct node.
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  5. #5
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Those are linker errors.
    Apparently you have no main function.
    And you can't use gdb if your program doesn't compile!
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  6. #6
    Registered User
    Join Date
    Sep 2013
    Posts
    7
    the problem was because I forget to define the " main function " ,,,, and the problem disappeared now )
    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 03-02-2011, 05:48 PM
  2. Replies: 2
    Last Post: 11-10-2010, 05:04 PM
  3. Replies: 4
    Last Post: 09-04-2010, 09:12 AM
  4. Replies: 1
    Last Post: 05-18-2010, 04:14 AM
  5. Replies: 1
    Last Post: 04-07-2008, 04:08 PM