CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Unions

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dxrose86



Joined: 28 Feb 2009
Posts: 5
Location: Taunton Ma

View user's profile Send private message Visit poster's website

Unions
PostPosted: Wed Jan 20, 2010 4:48 pm     Reply with quote

Hello I am using CCS v4.099 on a PIC18f26k20 processor. I am trying to compile a simple program with a union, and am getting the error message below the union.
Code:

 union
  {
    int8  uByte[2];
    int16 uWord;
  } CRC16;

  CRC16.uWord = 0xFFFF;     // Initialise CRC to 0xFFFF
 


This error is on the assignment of CRC16.uWord.
Quote:

Error 48 "p2.c" Line 61(3,8): Expecting a (
*** Error 48 "p2.c" Line 61(15,20): Expecting a (
*** Error 43 "p2.c" Line 61(17,23): Expecting a declaration
*** Error 43 "p2.c" Line 61(23,24): Expecting a declaration

This example was from a previous posting so I assume it compiled sometime.
Thanks
_________________
Micro-guy
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 21, 2010 1:28 am     Reply with quote

Quote:
union
{
int8 uByte[2];
int16 uWord;
} CRC16;

CRC16.uWord = 0xFFFF; // Initialise CRC to 0xFFFF

The line in bold has to be inside main() or some other function.
It can't be sitting out there alone.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group