Wiring Forum
http://wiring.org.co/cgi-bin/yabb/YaBB.pl
Programming Questions & Help >> Syntax >> Strange struct behaviour?
http://wiring.org.co/cgi-bin/yabb/YaBB.pl?num=1233170365

Message started by redman on 01/28/09 at 19:19:25

Title: Strange struct behaviour?
Post by redman on 01/28/09 at 19:19:25
Hi all,

Using Wiring 0018.

I have this code fragment in a header file:

...
typedef struct  {
   static  int Timer;
   static  int timeout;
   static  int TimerMax;
   static  int Timer2;
   static  int TimeOut2;
   static  int TimerMax2;
   static  int Timer3;
   static  int TimeOut3;
   static  int TimerMax3;
} CamTimers;

static CamTimers globalTim[7];
...


then i use the structure in a function :

char* WaitForAnswer(char portnum, char camnum, int timeout) {
...
    globalTim[camnum  - 1].Timer3 = 0;
...
}

and i get a compile error:

o: In function `WaitForAnswer(char, char, int)':
undefined reference to `._2::Timer3'

:(

anyone knows what's going on?

thanks

Title: Re: Strange struct behaviour?
Post by redman on 01/28/09 at 21:23:01
Never mind,

I removed the static identifiers inside the struct and now it compiles.

Wiring Forum » Powered by YaBB 2.5 AE!
YaBB Forum Software © 2000-2010. All Rights Reserved.