This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: using struct


> A simple question:
> 
> Can I use struct in ecos?

Yes.

> I tried to declare a struct inside a thread:
> 
> static void stimulus( cyg_addrword_t data )
> {
>     int i, j;
>  
>    struct hola{
>       int a;
>     };
> 
>     hola.a = 5; // This is 54 line.
> 	..
> 	..    
>     }
>  
> }
> 
> and i have the following error message:
> sync_mbox.c:54: `hola' undeclared (first use in this
> function)

This is a pure C issue. You have declared a struct, but you have not
delared an _instance_ of that struct. You should do it like this:

   struct {
      int a;
    } hola;

    hola.a = 5; // This is 54 line.

Notice the difference.

/Linus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]