Quote:
|
Originally Posted by wun
Hey,
I have been getting the following compile error ever since I added a certan function with a switch/case statement.
/cygdrive/c/mcc18/bin/mcc18.exe -p=18F8520 "user_routines.c" -fo="user_routines.o" /i"C:\\mcc18\\h" -D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
c:\robotics\FrcCode\user_routines.c:325:Error: syntax error
(note: This is the methoud I have used to compile code, and it has worked before)
Here is the code that is causing the error:
Code:
void Drive_the_Arm(void){
switch (light_status){
case NONE_IN_RANGE: Search_for_Light(LARGE_MOVE); break;
light_status is an unsigned charicter that has been defined as 0, NONE_IN_RANGE has been defined as 0 and LARGE_MOVE has been defined as 240. Search_for_Light is a function that accepts unsigned chars.
Does anyone have any ideas on what could be causing this error?
Thanks!
|
First of all, no tabs and use the CODE tag.
Second, try:
Code:
void Drive_the_Arm(void)
{
switch (light_status)
{
case NONE_IN_RANGE:
Search_for_Light(LARGE_MOVE);
break;
}
}
I believe that the colon also denotes lablels, And I think that you can't have commands on the same line (I certainly wouldn't!). Try that.
Also, is Large move a const or alias?