[Prev][Next][Index]

Re: gcc says "structure has no member"



In message <15362A277AA@hagiga.jct.ac.il> you write:
|Hi, 
|
|I have a problem compiling a program under Linux. 
|I know that what i do is not very standard, but under Dos 
|my compiler, (microsoft) did not complain and work fine.
|
|
|
|Begin ************* 
|
|struct FOO {		  /* this struct is in reality */ 
|	int no;		  /* something much, very much, bigger  */
|	union {		  /* It is a struct of struct and/or union */
|	  struct {
|	      unsigned char c1;
|	  }

missing semi-colon?

|foo.c:9: two or more data types in declaration of `c2'
|foo.c:9: long, short, signed or unsigned invalid for `c2'
|foo.c:12: warning: unnamed struct/union that defines no instances
|foo.c:12: warning: no semicolon at end of struct or union

Hey! Gcc agrees with me... (you know, "great minds think alike..." :)

|foo.c: In function `main':
|foo.c:19: structure has no member named `c1'
|foo.c:20: structure has no member named `c2'
|foo.c:21: structure has no member named `i'
|
|
|I think that it might exist a gcc option that allow to _not_ 
|give a name to a struct/union embeded in struct/union
|but allow to directly access the embeded fields using it/their 
|name(s).
|
|
|Any idea ?

Try looking at the comp.lang.c FAQ and newsgroup.

Cheers,

--Amos

--Amos Shapira                      | "Of course Australia was marked for
133 Shlomo Ben-Yosef st.            |  glory, for its people had been chosen
Jerusalem 93 805                    |  by the finest judges in England."
ISRAEL          amoss@cs.huji.ac.il |                     -- Anonymous