|
|
View previous topic :: View next topic |
Author |
Message |
jameszum
Joined: 31 Jan 2012 Posts: 14
|
TYPEDEF / STRUCT problem |
Posted: Tue May 06, 2014 10:46 am |
|
|
Good Morning
I have a question of typedef / struct and the CCS compiler.
I have the following from a commercial company .h file
I am using
CCS ide V 5.024
PCB V 5.024
PCM V 5.024
PCH V 5.024
PCD V 5.024
typedef unsigned char RD_BYTE;
typedef unsigned short RD_ID;
typedef unsigned short RD_UWORD;
57 typedef struct _RD_POSITION
58 {
59 RD_UWORD x;
60 RD_UWORD y;
61 } RD_POSITION;
62
63 static inline RD_POSITION Rd_Position(RD_UWORD x, RD_UWORD y)
64 {
65 RD_POSITION ret;
66 ret.x = x;
67 ret.y = y;
68 return ret;
69 }
the problem I have is that
*** Error 48 "ripdraw.h" Line 65(5,16): Expecting a (
*** Error 76 "ripdraw.h" Line 65(17,20): Expect ;
*** Error 12 "ripdraw.h" Line 66(5,8): Undefined identifier ret
*** Error 12 "ripdraw.h" Line 67(5,8): Undefined identifier ret
*** Error 118 "ripdraw.h" Line 68(12,15): Invalid type conversion ret
usage is
230 extern int Rd_SetLayerOriginAndSize(RD_INTERFACE* rd_interface, RD_ID layer_id, RD_POSITION position, RD_SIZE size);
*** Error 32 "C:\ripdraw.h" Line 230(81,92): Expecting a , or )
*** Error 43 "C:\ripdraw.h" Line 230(101,102): Expecting a declaration
*** Error 48 "C:ripdraw.h" Line 230(103,110): Expecting a (
*** Error 43 "C:\ripdraw.h" Line 230(115,116): Expecting a declaration
*** Error 43 "C:\ripdraw.h" Line 230(116,117): Expecting a declaration
I am unsure how to fix this problem ( or work around)
any help would be appreciated
thank you |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Tue May 06, 2014 12:01 pm |
|
|
Quote: | 63 static inline RD_POSITION Rd_Position(RD_UWORD x, RD_UWORD y)
64 {
65 RD_POSITION ret;
66 ret.x = x;
67 ret.y = y;
68 return ret;
69 }
the problem I have is that
*** Error 48 "ripdraw.h" Line 65(5,16): Expecting a (
*** Error 76 "ripdraw.h" Line 65(17,20): Expect ;
*** Error 12 "ripdraw.h" Line 66(5,8): Undefined identifier ret
*** Error 12 "ripdraw.h" Line 67(5,8): Undefined identifier ret
*** Error 118 "ripdraw.h" Line 68(12,15): Invalid type conversion ret |
First thought.
Errors are often caused by something several lines before the reported error.
In this case you are either missing a '(' in line 63 or got an extra ')'.
Mike |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1345
|
|
Posted: Tue May 06, 2014 12:42 pm |
|
|
I imagine it is the "inline" used in the function declaration. I'm not sure if CCS supports the use of "inline" in that manner. See #inline in the manual.
Try taking out "inline" and see if that gets rid of the error. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Tue May 06, 2014 2:02 pm |
|
|
Also, separate from the problem, a 'short' in CCS, defaults to a _single bit_, on PIC16/18 etc.. Generally be explicit when converting from other compilers, look up what size it expects for short/long etc., and use the explicit CCS sizes. Probably a signed int16 for an int, and an int8 for a 'short'.
'inline', is a c++ or c# declaration, not a C declaration.... |
|
|
|
|
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
|