Error still appears...any suggestion

anyone knows how to troubleshoot the error message
“make process closed with exit code : 2”

Here’s the code.

/*----------------------------------------------------------------------------*/
/*                                                                            */
/*    Module:       main.cpp                                                  */
/*    Author:       VEX                                                       */
/*    Created:      Thu Sep 26 2019                                           */
/*    Description:  Competition Template                                      */
/*                                                                            */
/*----------------------------------------------------------------------------*/

// ---- START VEXCODE CONFIGURED DEVICES ----
// Robot Configuration:
// [Name]               [Type]        [Port(s)]
// RightFrontMotor      motor         1               
// LeftFrontMotor       motor         2               
// RightBackMotor       motor         3               
// LeftBackMotor        motor         4               
// LeftArmLiftMotor     motor         5               
// LeftSpinMotor        motor         6               
// RightSpinMotor       motor         7               
// RightArmLiftMotor    motor         8               
// ---- END VEXCODE CONFIGURED DEVICES ----

#include "vex.h"

using namespace vex;

// A global instance of vex::brain
vex::brain     Brain;
//A global instance of vex::competition
vex::competition Competition;
vex::motor       RightFrontMotor      = vex::motor(vex::PORT1);
vex::motor       LeftFrontMotor       = vex::motor(vex::PORT2, true);
vex::motor       RightBackMotor       = vex::motor(vex::PORT3);
vex::motor       LeftBackMotor        = vex::motor(vex::PORT4, true);
vex::motor       LeftArmLiftMotor     = vex::motor(vex::PORT5);
vex::motor       RightArmLiftMotor    = vex::motor(vex::PORT8);

vex::motor       LeftSpinMotor   = vex::motor(vex::PORT6, true);
vex::motor       RightSpinMotor  = vex::motor(vex::PORT7);

vex::controller  Controller1     = vex::controller();
//vex::sensor      Sensor          = vex::sensor();


// define your global instances of motors and other devices here

/*---------------------------------------------------------------------------*/
/*                          Pre-Autonomous Functions                         */
/*                                                                           */
/*  You may want to perform some actions before the competition starts.      */
/*  Do them in the following function.  You must return from this function   */
/*  or the autonomous and usercontrol tasks will not be started.  This       */
/*  function is only called once after the V5 has been powered on and        */
/*  not every time that the robot is disabled.                               */
/*---------------------------------------------------------------------------*/

void pre_auton(void) {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // All activities that occur before the competition starts
  // Example: clearing encoders, setting servo positions, ...
}

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*                              Autonomous Task                              */
/*                                                                           */
/*  This task is used to control your robot during the autonomous phase of   */
/*  a VEX Competition.                                                       */
/*                                                                           */
/*  You must modify the code to add your own robot specific commands here.   */
/*---------------------------------------------------------------------------*/

void autonomous(void) {
  // ..........................................................................
  // Insert autonomous user code here.
  // ..........................................................................
 
 // Moving forward

 
 LeftFrontMotor.setStopping(coast);
 RightFrontMotor.setStopping(coast);
 LeftBackMotor.setStopping(coast);
 RightBackMotor.setStopping(coast);
 
 LeftFrontMotor.setVelocity(100, percent);
 RightFrontMotor.setVelocity(100, percent);
 LeftBackMotor.setVelocity(100, percent);
 RightBackMotor.setVelocity(100, percent);

 LeftFrontMotor.startRotateFor(vex::directionType::fwd,1000,vex::rotationUnits::deg);
 RightFrontMotor.startRotateFor(vex::directionType::fwd,1000,vex::rotationUnits::deg);
 LeftBackMotor.startRotateFor(vex::directionType::fwd,1000,vex::rotationUnits::deg);
 RightBackMotor.rotateFor(vex::directionType::fwd,1000,vex::rotationUnits::deg);

 LeftFrontMotor.stop();
 RightFrontMotor.stop();
 LeftBackMotor.stop();
 RightBackMotor.stop();




  // Turning left







   // Moving forward









    // Moving forward










     // Moving forward


}

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*                              User Control Task                            */
/*                                                                           */
/*  This task is used to control your robot during the user control phase of */
/*  a VEX Competition.                                                       */
/*                                                                           */
/*  You must modify the code to add your own robot specific commands here.   */
/*---------------------------------------------------------------------------*/

void usercontrol(void) {
  // User control code here, inside the loop
  int ArmSpeedPercent = 100;
  while (1) {
    // This is the main execution loop for the user control program.
    // Each time through the loop your program should update motor + servo
    // values based on feedback from the joysticks.

    // ........................................................................
    // Insert user code here. This is where you use the joystick values to
    // update your motors, etc.
    // ........................................................................

    //This section drives the chassis

    RightFrontMotor.spin(vex::directionType::fwd, Controller1.Axis2.position(), vex::velocityUnits::pct);
    RightBackMotor.spin(vex::directionType::fwd, Controller1.Axis2.position(), vex::velocityUnits::pct);
    LeftFrontMotor.spin(vex::directionType::fwd, Controller1.Axis3.position(), vex::velocityUnits::pct);
    LeftBackMotor.spin(vex::directionType::fwd, Controller1.Axis3.position(), vex::velocityUnits::pct);

    //This section is for the arm control aspect of the program

    if(Controller1.ButtonR1.pressing()){
      RightArmLiftMotor.spin(vex::directionType::fwd,ArmSpeedPercent,vex::velocityUnits::pct);
      
    }

    else if(Controller1.ButtonR2.pressing()){
      RightArmLiftMotor.spin(vex::directionType::rev,ArmSpeedPercent,vex::velocityUnits::pct);
      
    }

    else {
      RightArmLiftMotor.stop(vex::brakeType::brake);

      }

      if(Controller1.ButtonL1.pressing()){
      LeftArmLiftMotor.spin(vex::directionType::fwd,ArmSpeedPercent,vex::velocityUnits::pct);
      
    }

    else if(Controller1.ButtonL2.pressing()){
      LeftArmLiftMotor.spin(vex::directionType::rev,ArmSpeedPercent,vex::velocityUnits::pct);
      
    }

    else {
      LeftArmLiftMotor.stop(vex::brakeType::brake);

      }

      //This section is for the intake control aspect of the program

    if(Controller1.ButtonL1.pressing()){
      RightSpinMotor.spin(vex::directionType::fwd,ArmSpeedPercent,vex::velocityUnits::pct);
      LeftSpinMotor.spin(vex::directionType::fwd,ArmSpeedPercent,vex::velocityUnits::pct);
      
    }

    else if(Controller1.ButtonL2.pressing()){
      RightSpinMotor.spin(vex::directionType::rev,ArmSpeedPercent,vex::velocityUnits::pct);
      LeftSpinMotor.spin(vex::directionType::rev,ArmSpeedPercent,vex::velocityUnits::pct);
      
    }

    else {
      RightSpinMotor.stop(vex::brakeType::brake);
      LeftSpinMotor.stop(vex::brakeType::brake);

    }

    
    wait(20, msec); // Sleep the task for a short amount of time to
                    // prevent wasted resources.
  }
}

//
// Main will set up the competition functions and callbacks.
//
int main() {
  // Set up callbacks for autonomous and driver control periods.
  Competition.autonomous(autonomous);
  Competition.drivercontrol(usercontrol);

  // Run the pre-autonomous function.
  pre_auton();

  // Prevent main from exiting with an infinite loop.
  while (true) {
    wait(100, msec);
  }
}

Take a look at this article:

1 Like

I did but error still appears…help anyone?

What changes did you make to fix the error…because the error still appears

copy/paste the error in the output tab in VEXcode so we can make suggestions. All the necessary information is in the few lines above the “make process closed” line. My guess would be that you have multiple definitions of perhaps the Brain instance and/or motors or you have no vexcodeInit() function defined anywhere.

1 Like

Here’s from the output tab…

build/src/robot-config.o:(.bss.RightArmLiftMotor+0x0): multiple definition of `RightArmLiftMotor’

build/src/main.o:(.bss.RightArmLiftMotor+0x0): first defined here

build/src/robot-config.o:(.bss.RightBackMotor+0x0): multiple definition of `RightBackMotor’

build/src/main.o:(.bss.RightBackMotor+0x0): first defined here

build/src/robot-config.o:(.bss.RightFrontMotor+0x0): multiple definition of `RightFrontMotor’

build/src/main.o:(.bss.RightFrontMotor+0x0): first defined here

build/src/robot-config.o:(.bss.RightSpinMotor+0x0): multiple definition of `RightSpinMotor’

build/src/main.o:(.bss.RightSpinMotor+0x0): first defined here

make: *** [vex/mkrules.mk:18: build/TowertakeoverAuto.elf] Error 1

[error]: make process closed with exit code : 2

Any suggestion why the error still appears

looks like you have all of your motors defined in 2 places. once in your main code that you posted above, and once more in robot-config. Try removing the motor constructors in either of those places.

1 Like

Small suggestion, (Not related to the multiple def error), you should wait for about ~20 msec in your while true loop. The brain can update the motor a lot faster than 100 msec, which means you can have a better response time with your bot.

2 Likes