View previous topic :: View next topic |
Author |
Message |
flowlo
Joined: 19 Jan 2011 Posts: 1 Location: Austria
|
How to solve "Expecting an identifier" |
Posted: Wed Jan 19, 2011 4:08 pm |
|
|
I tried to compile following code:
Code: | /* A couple of defines */
int dcf(unsigned int* mode, short int* bits, unsigned int* time, unsigned int* clock, unsigned int* tick) {
/* Other code ... */ |
The CCS Compiler throws following error:
Quote: | Error[28] Z:\home\flowlo\...\src\dcf.c 19 : Expecting an identifier
1 Errors, 0 Warnings. |
Would you be so kind and help me out? |
|
![](templates/subSilver/images/spacer.gif) |
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Wed Jan 19, 2011 4:11 pm |
|
|
Sometimes the compiler will point to a line and say there's an error when in fact the error is just above the line being pointed to. Look in your code that is previous to this line and see if there's something amiss.
Ronald |
|
![](templates/subSilver/images/spacer.gif) |
dyeatman
Joined: 06 Sep 2003 Posts: 1924 Location: Norman, OK
|
|
Posted: Wed Jan 19, 2011 4:11 pm |
|
|
Must be a problem with code before this line.
Your line compiles with no problem under 4.114. _________________ Google and Forum Search are some of your best tools!!!! |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19359
|
|
Posted: Thu Jan 20, 2011 2:48 am |
|
|
There are a couple of other things:
You cannot have a pointer to a _short_. This is in the manual. Though it may compile, it will not work...
You can also get this error, if a keyword is being 're-used'. For instance, if there is a #define, making 'time' be replaced with the number '4', then the line parses out as:
Code: |
int dcf(unsigned int* mode, short int* bits, unsigned int* 4, unsigned int* clock, unsigned int* tick) {
|
and you would get the described error message.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Thu Jan 20, 2011 7:31 am |
|
|
Do you realize what a type short is in CCS? A short is only one bit, a Boolean. I don't think that is what you are looking for. A regular int is 8 bits. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
![](templates/subSilver/images/spacer.gif) |
|