Jump to content

Structs Containing Unions


Guest Joe

Recommended Posts

Seems like every other line of code i write produces a compiler error...

 

< in a header file >

// simplified //

typedef struct sMessage
{
 BYTE data[64];
 union sCrc
 {
     BYTE byCrc[2];
     WORD wCrc;
 }crc;
}MESSAGE;

 

 

 

Compiling...

 

"C:\Program Files\SourceBoost\boostc.pic16.exe" -t PIC16F84  Bootloader_18F.c

 

BoostC Optimizing C Compiler Version 2.0.1 Beta (for PIC16 architecture)

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

Copyright© 2004-2005 Pavel Baranov

Copyright© 2004-2005 David Hobday

 

 

Bootloader_18F.h(27): error: missing right brace

Bootloader_18F.h(6): error:  failure

failure

Failed to locate output file 'Bootloader_18F.obj'

Done

 

Failed

 

 

The above is perfectly valid 'C' code. It also fails with nested structs, so im guessing this is another limitation.... So when will this be implimented? unions are VERY usefull for efficent ram usage!

Link to post
Share on other sites
The above is perfectly valid 'C' code. It also fails with nested structs, so im guessing this is another limitation.... So when will this be implimented? unions are VERY usefull for efficent ram usage!

 

Unions are supported. Just define them outside a structure. I will look into this issue.

 

Regards,

Pavel

Link to post
Share on other sites
Seems like every other line of code i write produces a compiler error...

 

Actually this "perfectly valid 'C' code" compiled fine after I replaced BYTE/WORD with char/short. Are you sure you have BYTE/WORD defined?

 

Regards,

Pavel

Link to post
Share on other sites
Actually this "perfectly valid 'C' code" compiled fine after I replaced BYTE/WORD with char/short. Are you sure you have BYTE/WORD defined?

 

I´ve got same problem, defining a longint type. When I renamed it to dword, code compiled ok. I run it thru the debugger and it is working perfectly.

Link to post
Share on other sites
Actually this "perfectly valid 'C' code" compiled fine after I replaced BYTE/WORD with char/short. Are you sure you have BYTE/WORD defined?

 

I´ve got same problem, defining a longint type. When I renamed it to dword, code compiled ok. I run it thru the debugger and it is working perfectly.

 

Can you send a zipped project that has this problem to support@picant.com

 

Regards,

Pavel

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...
×
×
  • Create New...