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 support@ccsinfo.com

Problem with CCS "expecting an identifier"

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



Joined: 25 Apr 2009
Posts: 12

View user's profile Send private message MSN Messenger

Problem with CCS "expecting an identifier"
PostPosted: Sat Apr 25, 2009 1:35 am     Reply with quote

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. Wink
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sat Apr 25, 2009 5:12 am     Reply with quote

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

View user's profile Send private message MSN Messenger

Thank you
PostPosted: Sat Apr 25, 2009 5:35 am     Reply with quote

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







PostPosted: Sat Apr 25, 2009 9:22 am     Reply with quote

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

View user's profile Send private message MSN Messenger

PostPosted: Sat Apr 25, 2009 11:24 am     Reply with quote

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

View user's profile Send private message MSN Messenger

Still have problem
PostPosted: Sat Apr 25, 2009 11:35 am     Reply with quote

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

View user's profile Send private message MSN Messenger

Hi haha!!
PostPosted: Sat Apr 25, 2009 11:46 am     Reply with quote

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

View user's profile Send private message MSN Messenger

Huh! I've got a new error
PostPosted: Sat Apr 25, 2009 12:54 pm     Reply with quote

the error is "Identifier is already used in this scope"

How can I do? Sir.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sat Apr 25, 2009 1:10 pm     Reply with quote

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
Code:
#define BOOL int1
bungee-



Joined: 27 Jun 2007
Posts: 206

View user's profile Send private message

Re: Hi haha!!
PostPosted: Sat Apr 25, 2009 1:12 pm     Reply with quote

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

View user's profile Send private message MSN Messenger

reply
PostPosted: Sat Apr 25, 2009 11:08 pm     Reply with quote

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
Code:
#define BOOL int1


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

View user's profile Send private message MSN Messenger

Hi This is my Project please help me to compile success
PostPosted: Sun Apr 26, 2009 12:00 am     Reply with quote

http://www.uploadd.com/download.aspx?pku=3A517B174BF45U[RUKNMSCN2EWQ1D6


please help me Crying or Very sad
bungee-



Joined: 27 Jun 2007
Posts: 206

View user's profile Send private message

PostPosted: Sun Apr 26, 2009 6:54 am     Reply with quote

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

View user's profile Send private message AIM Address

BTW: ALL
PostPosted: Sun Apr 26, 2009 12:57 pm     Reply with quote

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.
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