Need help with CCS PIC C compiler

Status
Not open for further replies.

ckuecker

New Member
Hello,

I just bought a copy of the CCS PCH compiler to complete a job. I've previously used the Microchip C18 compiler, but my copy is old and does not support the processor I am using.

I am attempting to port code compiled with the Keil C51 / uVision system, that has run successfully on another design of mine using an 8051 variant. It's pretty much ANSI C.

I get errors with a structure declaration:

23 typedef union
24 {
25 int16 value;
26 unsigned char byte[2];
27 }W_UNION;

*** Error 28 "C:\C K Enterprises\Minco\MLS\Code\minco.h" Line 26(19,20): Expecting an identifier
*** Error 43 "C:\C K Enterprises\Minco\MLS\Code\minco.h" Line 26(20,21): Expecting a declaration
*** Error 43 "C:\C K Enterprises\Minco\MLS\Code\minco.h" Line 26(21,22): Expecting a declaration
*** Error 43 "C:\C K Enterprises\Minco\MLS\Code\minco.h" Line 26(22,23): Expecting a declaration
*** Error 43 "C:\C K Enterprises\Minco\MLS\Code\minco.h" Line 27(1,2): Expecting a declaration
*** Error 48 "C:\C K Enterprises\Minco\MLS\Code\minco.h" Line 27(2,9): Expecting a (

This code compiles fine under C51, and BoostC (which I can't use as there is no printf() function).

I hope it's not a case of CCS not allowing arrays or such.
Any ideas?
 
I would guess that "byte" is reserved. Try changing the name.

Mike.
 
That did it!

'byte' evidently was reserved, but as CCS does not include an index in their reference manual, I don't see where it might be documented.

#BYTE is defined to force a C variable to a fixed address in memory, though.

Thanks for the tip. Onward to the next error...

Chuck
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…