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

  1. #1
    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-24-2009, 11:30 PM
  2. Problem referencing structure elements by pointer
    By trillianjedi in forum C Programming
    Replies: 19
    Last Post: 06-13-2008, 05:46 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06: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