View Full Version : Help !!!
sonnguyen
02-02-2008, 22:24
Hi,
When I compile today, I get this problem
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\MCC18\bin\mcc18.exe" -p=18F8722 "autonomous.c" -fo="autonomous.o" -k -mL -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
C:\ifi_frc_simple_30\ifi_frc.h:31:Error [1027] unable to locate 'p18cxxx.h'
C:\ifi_frc_simple_30\serial_ports.h:48:Error [1027] unable to locate 'stdio.h'
MPLAB C18 v3.15 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited: 60
Halting build on first failure as requested.
How can I solve it ? I am using MPLAB v8.00
zkaratekid
02-02-2008, 22:28
hey our programmer said that you need to reinstall the upgrade for mplab 8 and make sure you have compiler v. 3
gotta fix your project's search paths.
find the project settings in the project menu, and change the paths.
include -> mcc18/h
library -> mcc18/lib
linker -> mcc18/lkr
sonnguyen
02-02-2008, 22:50
gotta fix your project's search paths.
find the project settings in the project menu, and change the paths.
include -> mcc18/h
library -> mcc18/lib
linker -> mcc18/lkr
Can you say more detail ?
I have the v.3 compiler
Open MPLab, open the project, go to Project -> Build Options -> Project
Then on the General tab (or something like Paths in v8), set the links like this:
Linker -> mcc18/lkr
Library -> mcc18/lib
Include -> mcc18/h
where mcc18 is the path to your c18 installation
sonnguyen
02-02-2008, 23:01
It seems that there is no such tab like you said
Well, look around and use common sense, there is one with paths, i know that for sure.
sonnguyen
02-02-2008, 23:16
I have done like you said. Now there is another problem
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\MCC18\bin\mcc18.exe" -p=18F8722 /i"C:\MCC18\h" "autonomous.c" -fo="autonomous.o" -k -mL -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.15 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited: 60
C:\ifi_frc_simple_30\autonomous.c:242:Error: syntax error
Halting build on first failure as requested.
Well, check line 242 in the autonomous.c file, there's a syntax error on that line.
sonnguyen
02-02-2008, 23:23
void Autonomous_Spin(void)
This is the line. Is there any error ?
Chaos in a Can
02-02-2008, 23:32
Check the lines above that for something like a missing brace or semicolon.
Since the C18 compiler gives ever-so-helpful error messages, I can't say for sure, but I'm guessing the compiler was expecting a semicolon at the end of a statement or a closing curly-brace, but instead it found "void Autonomous_Spin(void)".
The syntax error occurred on line 242, but the problem that caused it isn't necessarily on that line. The actual problem is often on the line above the one the compiler says it is.
Without the surrounding code, it's hard to tell. Based on that file name, I'm assuming you're using Kevin's v3 code, correct? Did you modify that file?
sonnguyen
02-02-2008, 23:35
yeah i did modify the file.
I don't have any code surronding that one
It said it's version is v.0.1
Well, without the whole file, it's hard to tell what's wrong, but do you have semicolons and closing brackets everywhere? (Those would result in something more like "expected xx instead of yy" errors, though...)
Chaos in a Can
02-02-2008, 23:44
Check the last few lines that have code on them that are before where you get the error.
Better yet, show those lines.
I'm pretty sure C18 doesn't give "expected ..." errors for missing/extra semicolons and braces.
It just says "syntax error".
The only time it seems to give and "expected" error is when you use . instead of -> or the other way around.
yeah, you're right, c18 doesn't give those errors, even though it should.
sonnguyen
03-02-2008, 09:02
void Teleop(void)
{
// enable this to use IFI's default robot code
// Default_Routine(); // located in ifi_code.c
pwm01 = 255 - Limit_Mix(2000 + p1_y + p1_x - 127);
pwm02 = Limit_Mix(2000 + p1_y - p1_x + 127);
pwm10=pwm11=p2_x;
// update the state of the LEDs on the operator interface
Update_OI_LEDs(); // located in ifi_code.c
}
Here is the part before the error. Can someone help me ?
Gamer930
03-02-2008, 10:30
void Teleop(void) is in teleop.c
void Autonomous_Spin(void) where you said the error is located in autonomous.c
your error is going to be in your void Autonomous(void) function. Maybe forgot to close a Bracket or semicolons
sonnguyen
03-02-2008, 10:45
Can someone check for me ?
void Autonomous(void)
{
/* Add your own autonomous code here. */
/*Bob's Code starts*/
/* SCENARIO 1 ----
step 1 grip keeper
step 2 raise arm
step 3 drive forward 3 seconds full
step 4 realease keeper and move backwards
step 5 wait
*/
// Autonomous_Code is determined by the position of the switch
// rc_dig_in16 switch on the robot rc AUTONOMOUS mode
// rc_dig_in15 switch on the robot rc AUTONOMOUS mode
//#define AUTO_MODE_DEFAULT 0 // NO switch on the Robot at all
// AUTO_MODE_DEFAULT 1 // if switch on rc_dig_in15
// AUTO_MODE_ARM 2 // if switch in the middle
// AUTO_MODE_DEFENSE 3 // if switch on rc_dig_in16
//#define AUTONOMOUS_GO_TO_Rack ( (int)rc_dig_in16 == 0)
/*set our default - no switch on bot */
Autonomous_Code = AUTO_MODE_DEFAULT ;
Finney_auto_counter++;
// we need to find out if the switch is installed on the RC in Digital IN/OUT
// if so, then run the appropriate Autonomos code
if ( (!rc_dig_in15) )
Autonomous_Code = AUTO_MODE_DEFAULT ; // run code for position 15
else if ( (!rc_dig_in16) )
Autonomous_Code = AUTO_MODE_DEFENSE ; // run code for position 16
else if ( (rc_dig_in16) && (rc_dig_in15) ) // run code for MIDDLE position
Autonomous_Code = AUTO_MODE_ARM ;
if ( (rc_dig_in16) && (rc_dig_in15) ) // switch is in middle or missing
{ // Going forward for three seconds.
left_drive = left2_drive = 210;
right_drive = right2_drive = 44;
if (Finney_auto_counter > 78) step++;
}
else if ( (!rc_dig_in16) || (!rc_dig_in15) ) // for position 15 or 16
{
switch (step)
{
case 1:
/***** STEP 1 ******/
//grip keeper ring
// claw_close = 1;
// printf("auto step =%d \r\n", step);
if (Finney_auto_counter > 26) step++; //was 95
break;
case 2:
/***** STEP 2 ******/
// raise arm.
// arm = 90;
if (Finney_auto_counter > 78) step++;
break;
case 3: /***** STEP 3 ******/
// drive forward.
left_drive = left2_drive = 220;
right_drive = right2_drive = 60;
if (Finney_auto_counter > 95) step = 5;
break;
case 4: /***** STEP 4 ******/
// release keeper and drive backwards
// claw_open = 1;
//claw_close = 0;
left_drive = left2_drive = 69;
right_drive = right2_drive = 69;
if (Finney_auto_counter > 380) step++;
break;
case 5: /***** STEP 5 ******/
// stop and wait.
left_drive = left2_drive = 127;
right_drive = right2_drive = 127;
if (Finney_auto_counter > 131) step++;
break;
case 6: /***** STEP 6 ******/
// look for the light and move towards it
Process_Data_From_Master_uP();
if (Get_Tracking_State() == SEARCHING)
{
left_drive = left2_drive = right_drive = right2_drive = 127;
}
// This is so when it's not searching, it's moving towards the light
else
{
// turn robot right toward the light
if(PAN_SERVO < 124)
{
left_drive = left2_drive = 230;
right_drive = right2_drive = 128;
}
// turn robot left toward the light
else if(PAN_SERVO > 124)
{
left_drive = left2_drive = 128;
right_drive = right2_drive = 76;
}
// drive robot straight toward the light until 5 feet in front
else if((116/tan(180*(((TILT_SERVO-144)*25)/50)/3.1415)) > 5) // This converts the PWMs to radians and uses trig to find the distance
{
left_drive = left2_drive = 230;
right_drive = right2_drive = 76;
}
}
default:
left_drive = left2_drive = 127;
right_drive = right2_drive = 127;
// claw_close = 0;
break;
} /* End of Switch ( Finney_auto_counter) */
/*Bob's Code ends*/
}
jacobhurwitz
03-02-2008, 12:06
I know this may be a pain, but try commenting out blocks of your code at a time. Comment out a huge block that fixes the problem, then make the block smaller and smaller until you find the line that causes the problem.
psy_wombats
03-02-2008, 12:15
Just ran it through a formatting routine in Eclipse. It looks like this line is not closed:
else if ( (!rc_dig_in16) || (!rc_dig_in15) ) // for position 15 or 16
{
Try adding the extra brace back wherever it should be, probably at the end. Either way, a brace is missing.
jacobhurwitz
03-02-2008, 12:16
Just ran it through a formatting routine in Eclipse. It looks like this line is not closed:
} else if ( (!rc_dig_in16) || (!rc_dig_in15) ) // for position 15 or 16
Try adding the extra brace back wherever it should be, probably at the end. Either way, a brace is missing.
Eclipse is... useful? On our school computers, it's just plain slow.
sonnguyen
03-02-2008, 13:58
The problem is actually, I have tried to compile on another laptop with the same codes and it worked.
What's the problem here ?
psy_wombats
03-02-2008, 14:03
Have you tried adding the extra brace right before the function? That code definitely will not compile as is. The syntax error just means the function before it never closed, so it isn't anything compiler specific at the moment.
Or are you getting a different error? If so, what is it?
sonnguyen
03-02-2008, 14:18
I mean that I use the same codes on the other laptop and it worked. Thus, It means there shouldn't be anything wrong with the codes
Why doesn't it work on my computer ?
psy_wombats
03-02-2008, 14:23
I'll assume you're talking about the syntax error. If not, say so.
The code on the other computer must not be identical, as it does not respond to the syntax error which is apparent. I am quite sure it will dissapear (and therefore compile) if you add the other brace. Try that, and see if the problem goes away. If you have already fixed the brace issue, is the syntax error still there?
sonnguyen
03-02-2008, 14:32
where should i put the brace ?
psy_wombats
03-02-2008, 14:36
The brace should close this line:
else if ( (!rc_dig_in16) || (!rc_dig_in15) ) // for position 15 or 16
{
I think this ends at the end of the function? If I understand what your code does, put it before this, assuming its where that if ends:
/*Bob's Code ends*/
}
sonnguyen
03-02-2008, 14:42
there is another problem after I solved that problem
It says
[B]Clean: Done.
Executing: "C:\MCC18\bin\mcc18.exe" -p=18F8722 /i"C:\MCC18\h" "autonomous.c" -fo="autonomous.o" -k -mL -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.15 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited: 59
C:\ifi_frc_simple_30\autonomous.c:135:Error [1105] symbol 'left_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:135:Error [1105] symbol 'left2_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:135:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:135:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:136:Error [1105] symbol 'right_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:136:Error [1105] symbol 'right2_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:136:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:136:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:160:Error [1105] symbol 'left_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:160:Error [1105] symbol 'left2_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:160:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:160:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:161:Error [1105] symbol 'right_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:161:Error [1105] symbol 'right2_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:161:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:161:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:169:Error [1105] symbol 'left_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:169:Error [1105] symbol 'left2_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:169:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:169:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:170:Error [1105] symbol 'right_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:170:Error [1105] symbol 'right2_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:170:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:170:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:176:Error [1105] symbol 'left_drive' has not been defined
Halting build on first failure as requested.
BUILD FAILED: Sun Feb 03 14:40:41 2008
psy_wombats
03-02-2008, 14:45
Okay... Well, did you actually define those? If so, where? Did you include that file's header? You may want to just attach a zip of your entire code. And what are those two values? Are they supposed to be motor macros or actual variables? Where are they referred to?
paulcd2000
03-02-2008, 15:06
Can someone check for me ?
void Autonomous(void)
{
...
}
Ok, just a few requests
First, when you want others to read your code, indentation helps. Heck, it even helps if you don't want others to read it. Helps catch closing bracket errors.
Second, when your putting code in, wrap it in code tags
[ CODE][ /CODE]
just remove the spaces inside the braces, and put your code in between. much easier to read
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.