|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
This code will NOT compile
Hello. We're having a problem...The compiler won't compile this, and we don't know why...Is there anything wrong? It seems syntactically correct...
|
|
#2
|
||||||
|
||||||
|
Re: This code will NOT compile
Code:
int cube (p1_y);
{
return p1_y * p1_y * p1_y
}
int cube2 (p2_y);
{
return p2_y * p2_y * p2_y
}
int square (p1_y);
{
return p1_y * p1_y
}
int square2 (p2_y);
{
return p2_y * p2_y
}
|
|
#3
|
|||
|
|||
|
Re: This code will NOT compile
We didi put it outside any functions...at the top of the "user routines" file, and it still wouldn't be compile...Where should the declarations of functions and any user code we need go?
Last edited by greatman05 : 15-02-2008 at 19:05. |
|
#4
|
||||||
|
||||||
|
Re: This code will NOT compile
I noticed a few more errors in your functions.
Code:
int square2 (p2_y);
{
return p2_y * p2_y
}
If you want separate functions for each joystick axis, you could write it like: Code:
int square2 ()
{
return (p2_y * p2_y);
}
Code:
int square2 (int variable_to_square)
{
return (variable_to_square * variable_to_square);
}
Note: It's much easier to help if you tell us what the error message is and what code is causing it. |
|
#5
|
|||
|
|||
|
Re: This code will NOT compile
OK...Thanks! It basically was a syntax error, and everytime we got something to work, it had a syntax error with the "{" and/or the "}"...the file was the user_routines.c file, where I thought you were supposed to put user code...
|
|
#6
|
|||
|
|||
|
Re: This code will NOT compile
Code:
int cube1 (unsigned char p1_y)
{
return((int)p1_y * (int)p1_y * (int)p1_y);
}
Code:
ifi_aliases.h:30: #define p1_y rxdata.oi_analog01 and unless you are absolutely certain of the precedence rules for applying operations - use parentheses to eliminate any questions: Code:
pwm01 = cube() - (3 * square() ) + (5 * p1_y); /*x^3-3x^2+5x* A cubic function to regulate the sensitivity of the robot's drive*/ pwm02 = cube2() - (3 * square2()) + (5 * p2_y); /*same thing, son*/ Last edited by dcbrown : 15-02-2008 at 20:52. |
|
#7
|
|||
|
|||
|
Re: This code will NOT compile
Actually you're missing semi colons everywhere.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Default code will not compile | bronxbomber92 | Programming | 7 | 18-01-2008 18:44 |
| Does anyone else think this game will not be as good as I imagine it might be? | NeedMoreEngines | FRC Game Design | 76 | 15-01-2006 21:15 |
| heres the code. y this not working | omega | Programming | 16 | 31-03-2004 15:18 |
| What is wrong with this code???? It won't Compile and I don't know why? Please Help | CrashZero | Programming | 23 | 26-03-2004 09:44 |
| My other computer will not work with this forum! | David Kelso | CD Forum Support | 4 | 04-06-2001 21:52 |