I keep getting this error can you please help me

I’ve been programming this. it creates really nice turns with a gyroscope but I keep getting these errors: variable has incomplete type ’ void’ (25,6) and expected ‘;’ after top level declarator (25,43) can you please help me thankyou.

here is my code:

// Include the IQ Library
#include “iq_cpp.h”

// Allows for easier use of the VEX Library
using namespace vex;

int error;
int output;
int input;
int Distance;
int Heading;
int Velocity;
int Kp;

void Turn(Distance, Heading, Velocity, Kp) {
leftMotor.spinToPosition(0, degrees);
RightMotor.spinToPosition(0, degrees);
if(Velocity > 0){
while(leftMotor.position(degrees) < Distance){
error = Heading - Gyro.rotation();
output = error * Kp
leftMotor.setVelocity(Velocity - output, percent);
rightMotor.setVelocity(Velocity + output, percent);
leftMotor.spin(forward);
rightMotor.spin(forward);
}
}
else {
while(leftMotor.position(degrees) > Distance){
error = Heading - Gyro.rotation();
output = error - kp
leftMotor.setVelocity(Velocity - output, percent);
rightMotor.setVelocity(Velocity + output, percent);
leftMotor.spin(forward);
rightMotor.spin(forward);
}
}
leftMotor.stop();
rightMotor.stop();
}

Forgot to mention :joy: i’m using vexcodeiq for windows

The parameters to the turn function need to have a type, ie. int, double or whatever is appropriate.

8 Likes

ok I’ll look into that thanks!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.