Jump to content
Sign in to follow this  
Guest Joe

Structs Don't (appear) To Work

Recommended Posts

Guest Joe

.c file (not in a function):

typedef struct sTimes
{
   BYTE OnTimeHours;
   BYTE OnTimeMinuites;
   BYTE OffTimeHours;
   BYTE OffTimeMinuites;
}TIMES;

TIMES Times[] = 
{
    {	12, 10,         15, 40	}
   ,{	13, 20,         16, 45	}
   ,{	14, 30,         17, 50	}
};

 

does not compile, tested in VC without error.

 

 

Boost error:

 

Compiling...

 

"C:\Program Files\SourceBoost\boostc.pic16.exe" -t PIC12F629 OnOffTimer.c

 

BoostC Optimizing C Compiler Version 1.8 Alpha (for PIC16 architecture)

http://www.picant.com/c2c/c.html

Copyright© 2004 Pavel Baranov

Copyright© 2004 David Hobday

 

 

OnOffTimer.c(33): error: unexpected '{'

failure

Failed to locate output file 'OnOffTimer.obj'

Done

 

Failed

Share this post


Link to post
Share on other sites

Joe,

 

C2C compiler doesn't support structs, you need BoostC compiler for that.

 

Regards

Dave

Share this post


Link to post
Share on other sites

Joe,

 

Cheers Dave, do you know when initilisation inside declaration will be added to BoostC ?

 

I don't know the answer to this, its one for Pavel.

 

Regards

Dave

Share this post


Link to post
Share on other sites
Guest Joe

Humm,

 

Im trying to store an initilised struct in ROM, but cant because cant use initilized structs, so i thought i'd store a byte arry in rom, and typecast a pointer (that points to the rom) to my struct type and use that, but that doesn't work either!

 

 

struct sTimes
{
   BYTE OnTimeHours;
   BYTE OnTimeMinutes;
   BYTE OffTimeHours;
   BYTE OffTimeMinutes;
}TIMES;

rom BYTE Times[7][4] =
{
{  12, 10,   15, 40  }
,{  12, 10,   15, 40  }
,{  12, 10,   15, 40  }
,{  12, 10,   15, 40  }
,{  12, 10,   15, 40  }
,{  12, 10,   15, 40  }
,{  12, 10,   15, 40  }
};	

TIMES* pTimes = &Times;   // nope !

Share this post


Link to post
Share on other sites
Guest Joe

Initilised structs are still not possible in the latest boostC release BC 1.9.

 

 

When will this be added? And will they be allowed to be of type const (or rom or whatever you are calling it nowadays) ?

 

Joe

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...