Go to Post I too can find a method with correlation bias by applying a pattern to most datasets! - BrennanB [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-02-2007, 18:21
Xenosthebest Xenosthebest is offline
Registered User
FRC #0701
 
Join Date: Feb 2007
Location: Travis AFB
Posts: 14
Xenosthebest is an unknown quantity at this point
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!
  #2   Spotlight this post!  
Unread 09-02-2007, 18:36
ebowla's Avatar
ebowla ebowla is offline
The Overmind
FRC #2016
Team Role: Programmer
 
Join Date: Dec 2006
Rookie Year: 2006
Location: Ewing High School
Posts: 15
ebowla is on a distinguished road
Re: Am i just not seeing it?

did you try double clicking the error to see where it goes?
__________________
Progamming Master
Disclaimer: May not be actually as good as claimed, not reliable for advice, and shirks away any real work.
  #3   Spotlight this post!  
Unread 09-02-2007, 18:38
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
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 */
.....

int x // <--- Missing semicolon

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;
}
and got the following error
Code:
test.c:18: error: syntax error before "static"
Hope that helps.
  #4   Spotlight this post!  
Unread 09-02-2007, 18:38
Xenosthebest Xenosthebest is offline
Registered User
FRC #0701
 
Join Date: Feb 2007
Location: Travis AFB
Posts: 14
Xenosthebest is an unknown quantity at this point
Re: Am i just not seeing it?

yes, i put a little arrow where it goes.
  #5   Spotlight this post!  
Unread 09-02-2007, 18:44
Jim E Jim E is offline
Registered User
FRC #1523 (M.A.R.S.)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Lantana, FL
Posts: 188
Jim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond repute
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.

__________________
Team MARS = 1.523 AU from the SUN!

Jim E.
  #6   Spotlight this post!  
Unread 09-02-2007, 18:44
Xenosthebest Xenosthebest is offline
Registered User
FRC #0701
 
Join Date: Feb 2007
Location: Travis AFB
Posts: 14
Xenosthebest is an unknown quantity at this point
Re: Am i just not seeing it?

yes i have checked for all missing braces and semicolons. still nothing.
  #7   Spotlight this post!  
Unread 09-02-2007, 18:46
lukevanoort lukevanoort is offline
in between teams
AKA: Luke Van Oort
no team
 
Join Date: Oct 2005
Rookie Year: 2005
Location: Waterloo, ON, Canada
Posts: 1,873
lukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond repute
Send a message via AIM to lukevanoort
Re: Am i just not seeing it?

Quote:
Originally Posted by Xenosthebest View Post
yes i have checked for all missing braces and semicolons. still nothing.
Can you attach the file?
__________________
Team 1219: 2009 - Mentor
Team 587: 2005 - Animator, 2006-2008 - Team Captain
  #8   Spotlight this post!  
Unread 09-02-2007, 20:28
gnirts gnirts is offline
Suspicious pointer conversion
AKA: Robinson Levin
FRC #1648 (The Gearbox Gangstaz)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: ATL
Posts: 116
gnirts will become famous soon enough
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) {
    int i;
    int j;

    i = j /4; //this line is for some reason producing an error
    return i;
}
So do this:
Code:
int someFunction(void) {
    int i;
    int j;
    
    printf("hello");
    i = j /4; //this line is for some reason producing an error
    printf("everyone");
    return i;
}
And see if the compiler still says its on the same line, or if it is now stopping on the upper or lower printf(). If so, then you know your error is on either side of the statement you were looking at, so check for the usual missing ; or }.

Good luck,
Robinson
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pic: Just was not enough room Rich Wong Extra Discussion 6 15-04-2005 18:58
It's not just about the competition! Franchesca General Forum 8 28-07-2004 13:31
digital inputs not valid just after initialization? WizardOfAz Programming 2 26-01-2004 13:21
NO, I'm not just reviving a dead forum Hubicki Rules/Strategy 6 14-07-2002 17:44


All times are GMT -5. The time now is 00:21.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi