![]() |
Am i just not seeing it?
Every time i compile this code for our ramp control, itll tell me that i have a syntax error, when nothing is wrong.
Here it is: Problem is here!---> static void do_manual_override( void ) { if (left_ramp_up == CLOSED) { left_motor_pwm = motor_up; } else if (left_ramp_down == CLOSED) { left_motor_pwm = motor_down; } else left_motor_pwm = motor_off; if (right_ramp_up == CLOSED) { right_motor_pwm = motor_up; } else if (right_ramp_down == CLOSED) { right_motor_pwm = motor_down; } else right_motor_pwm = motor_off; } Any feedback is appreciated! |
Re: Am i just not seeing it?
did you try double clicking the error to see where it goes?
|
Re: Am i just not seeing it?
That function compiles fine for me. My guess is that the error is actually in the line/statement above your function definition. Are you missing a semicolon, closing brace, or closing parenthesis there?
For example, I tried this code Code:
/*Various declarations to get the function to compile */Code:
test.c:18: error: syntax error before "static" |
Re: Am i just not seeing it?
yes, i put a little arrow where it goes.
|
Re: Am i just not seeing it?
I put you code into a default camera routine and it compiled and linked. I suspect the error you are seeing is just above the line where the syntax error is occurring. Look for a missing bracket or semi-colon.
:confused: :confused: |
Re: Am i just not seeing it?
yes i have checked for all missing braces and semicolons. still nothing.
|
Re: Am i just not seeing it?
Quote:
|
Re: Am i just not seeing it?
Check the file the was compiled just before it, or more likely the last file #include'd in the the file where the error appears. Look for missing }s. The compiler is weird that way, although possibly technically right, as the faulty syntax isn't until something unexpected happens, like when you try and start one function definition inside another one.
Another way to isolate invisible errors inside a file is to put known-good code before and after the line with the error, eg. Code:
int someFunction(void) {Code:
int someFunction(void) {Good luck, Robinson |
| All times are GMT -5. The time now is 04:45. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi