View previous topic :: View next topic |
Author |
Message |
chongado
Joined: 25 Apr 2009 Posts: 12
|
Problem with CCS "expecting an identifier" |
Posted: Sat Apr 25, 2009 1:35 am |
|
|
Hi there,
I got a problem with error "expecting an identifier"
at this line --> static void DoWrite(void); in my code
I don't understand, Could you help me Sir?
Thank you. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Apr 25, 2009 5:12 am |
|
|
The error isn't in this line. It's either appearing in the wrong place, or there is a syntax error before. |
|
|
chongado
Joined: 25 Apr 2009 Posts: 12
|
Thank you |
Posted: Sat Apr 25, 2009 5:35 am |
|
|
FvM wrote: | The error isn't in this line. It's either appearing in the wrong place, or there is a syntax error before. |
Thank you, I'll check the code before this line. |
|
|
Ttelmah Guest
|
|
Posted: Sat Apr 25, 2009 9:22 am |
|
|
Look further back if there is still nothing obvious.
This is an at times 'unfortunate' feature of CCS, where it will quite often give an error quite a few lines 'after' the actual problem. The compiler keeps 'trudging through' the lines, till a perfectly normal line fails, because it reads it in a completely 'wrong' way....
Best Wishes |
|
|
chongado
Joined: 25 Apr 2009 Posts: 12
|
|
Posted: Sat Apr 25, 2009 11:24 am |
|
|
Ttelmah wrote: | Look further back if there is still nothing obvious.
This is an at times 'unfortunate' feature of CCS, where it will quite often give an error quite a few lines 'after' the actual problem. The compiler keeps 'trudging through' the lines, till a perfectly normal line fails, because it reads it in a completely 'wrong' way....
Best Wishes |
Umm.. ok I got it. ^^ |
|
|
chongado
Joined: 25 Apr 2009 Posts: 12
|
Still have problem |
Posted: Sat Apr 25, 2009 11:35 am |
|
|
Hi Sir. I'll post my source for you.
Code: |
#define XEE_SUCCESS FALSE
#define EEPROM_BUFFER_SIZE (32)
typedef BOOL XEE_RESULT;
typedef unsigned long DWORD;
void DoWrite(void);
void XEEInit(void);
XEE_RESULT XEEBeginWrite(DWORD address);
XEE_RESULT XEEWrite(BYTE val);
XEE_RESULT XEEEndWrite(void);
XEE_RESULT XEEBeginRead(DWORD address);
BYTE XEERead(void);
XEE_RESULT XEEReadArray(DWORD address, BYTE *buffer, BYTE length);
XEE_RESULT XEEEndRead(void);
BOOLEAN XEEIsBusy(void);
static DWORD EEPROMAddress;
static BYTE EEPROMBuffer[EEPROM_BUFFER_SIZE];
static BYTE *EEPROMBufferPtr; |
This is all source code in a file of my project and I still have old problem. |
|
|
chongado
Joined: 25 Apr 2009 Posts: 12
|
Hi haha!! |
Posted: Sat Apr 25, 2009 11:46 am |
|
|
I found something when I comment some code
Code: | /*
#define XEE_SUCCESS FALSE
#define EEPROM_BUFFER_SIZE (32)
typedef BOOL XEE_RESULT;
typedef unsigned long DWORD;
*/
void DoWrite(void);
void XEEInit(void);
XEE_RESULT XEEBeginWrite(DWORD address);
XEE_RESULT XEEWrite(BYTE val);
XEE_RESULT XEEEndWrite(void);
XEE_RESULT XEEBeginRead(DWORD address);
BYTE XEERead(void);
XEE_RESULT XEEReadArray(DWORD address, BYTE *buffer, BYTE length);
XEE_RESULT XEEEndRead(void);
BOOLEAN XEEIsBusy(void);
static DWORD EEPROMAddress;
static BYTE EEPROMBuffer[EEPROM_BUFFER_SIZE];
static BYTE *EEPROMBufferPtr;
|
the old error disappear!!!!
How can I define something like the code that I comment it?
Thank you.^^ |
|
|
chongado
Joined: 25 Apr 2009 Posts: 12
|
Huh! I've got a new error |
Posted: Sat Apr 25, 2009 12:54 pm |
|
|
the error is "Identifier is already used in this scope"
How can I do? Sir. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Apr 25, 2009 1:10 pm |
|
|
I can't see, how the code should compile when commenting the said part.
The problem is actually with BOOL, that is neither a standard C nor a CCS specific type identifier (Though it's defined with many PC compilers). Simply provide a definition like
|
|
|
bungee-
Joined: 27 Jun 2007 Posts: 206
|
Re: Hi haha!! |
Posted: Sat Apr 25, 2009 1:12 pm |
|
|
chongado wrote: |
typedef BOOL XEE_RESULT;
typedef unsigned long DWORD;
*/
|
try like that:
Code: | typedef int1 XEE_RESULT; |
It is possible that DWORD is allready defined. Try to use another identifier. |
|
|
chongado
Joined: 25 Apr 2009 Posts: 12
|
reply |
Posted: Sat Apr 25, 2009 11:08 pm |
|
|
FvM wrote: | I can't see, how the code should compile when commenting the said part.
The problem is actually with BOOL, that is neither a standard C nor a CCS specific type identifier (Though it's defined with many PC compilers). Simply provide a definition like
|
Hi Sir. In a header file that I include in my .c file, It's define a BOOL like this "typedef int1 BOOL" (this include file is before I use "typedef BOOL XEE_RESULT") |
|
|
chongado
Joined: 25 Apr 2009 Posts: 12
|
|
|
bungee-
Joined: 27 Jun 2007 Posts: 206
|
|
Posted: Sun Apr 26, 2009 6:54 am |
|
|
You are trying to combine files for different compilers. This will not work. You need to rewrite the complete SPIEEPROM to be compatible with CCS compiler. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
BTW: ALL |
Posted: Sun Apr 26, 2009 12:57 pm |
|
|
for those wondering:
STATIC and BOOL syntax both belong in the ( personally observed to be ) gawd_awful BAAD SOURCEBOOST ( alleged ) compiler universe.
That brings one closer to the dark little the heart of where the trouble is with this code as posted.
I was early on a victim of that pretty horrible mess o'compiler myself.
Never going back tho.
I would urge that a complete rewrite be done, utilizing CCS intrinsics, before the next attempt to compile. |
|
|
|