Error:request for member in sthg not a structure or union

This is a discussion on Error:request for member in sthg not a structure or union within the C Programming forums, part of the General Programming Boards category; Hello to all i have a union in Yacc (parser.y) like that : Code: %union { int intValue; char *stringValue; ...

  1. #1
    g_p
    g_p is offline
    Registered User
    Join Date
    Dec 2006
    Posts
    85

    Error:request for member in sthg not a structure or union

    Hello to all

    i have a union in Yacc (parser.y) like that :

    Code:
    %union {
    
                 int intValue;
                 char *stringValue;
                }    /* a ';' is not needed here */
    When i link the parser and the scanner together , i get the error error: request for member `intValue' in something not a structure or union

    Does anybody have any idea about it?

    Thanks, in advance!

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    9 times out of ten when I get this error, it is because I have something like:
    Code:
    union blah
    {
       int x;
       ...
    };
    
    ...
    
    void func(union blah *p)
    {
       p.x ...
    }
    In this case, we want p->x (or (*p).x)

    Without seeing your actual code, it's impossible to say.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. structure and union
    By BEN10 in forum C Programming
    Replies: 10
    Last Post: 06-25-2009, 12:30 AM
  2. Problem referencing structure elements by pointer
    By trillianjedi in forum C Programming
    Replies: 19
    Last Post: 06-13-2008, 06:46 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  4. Structure containing a union of more structures!
    By Bajanine in forum Windows Programming
    Replies: 2
    Last Post: 03-08-2003, 11:53 AM
  5. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21