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

Im trying to upload code, and it wont upload code. it says “[error]: make process closed with exit code : 2” any Ideas?

Most likely a missing } or ;
Check the line right before that in the console, should give the code line location.

We’re gonna need to see more about it. Could you post the entire error?

nt main(void) {

while(true){
//Code that tips the slide with cubes
if(jcon.ButtonL1.pressing()){
motorst.spin(directionType::fwd);
}else if (jcon.ButtonL2.pressing()){
motorst.spin(directionType::rev);
}else{
motorst.stop(brakeType::hold);
}
//drive code for Xdrive
motorbl.spin(directionType::fwd,jcon.Axis3.value()+jcon.Axis1.value()-jcon.Axis4.value(),velocityUnits::pct);
motorfl.spin(directionType::fwd,jcon.Axis3.value()+jcon.Axis1.value()+jcon.Axis4.value(),velocityUnits::pct);
motorbr.spin(directionType::fwd,jcon.Axis3.value()-jcon.Axis1.value()+jcon.Axis4.value(),velocityUnits::pct);
motorfr.spin(directionType::fwd,jcon.Axis3.value()-jcon.Axis1.value()-jcon.Axis4.value(),velocityUnits::pct);
}

}

And here is the error
unix build for platform vexv5

CXX src/main.cpp

LINK build/XDRIVE_Controllerb.elf

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

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

make: *** [build/XDRIVE_Controllerb.elf] Error 1

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

Your code compiled for me. Only change I made was “int main(){” You did not put “i”

Unsure if you did not copy the “i” when you created this thread or you forgot to put the i in your function.

it says “int” on mine. Im not really sure what’s going wrong

@marcosdt1972 Just so it’s easier to see the code:

indent preformatted text by 4 spaces

Capture

I don’t know, mine still wont work.

You defined everything outside of main correct?

Yes, all defined out of main

Missed something: try putting your definitions in main.cpp if they aren’t. That multiple definitions error can occur when you don’t correctly define variables/objects in a separate file and the one they are referenced in. I’ve had that issue before I learned how CPP actually works

47%20PM
This is my code, doesnt upload

Sorry to add to this thread, but
I just got vex code and I am having the exact same issue. I do not see anything wrong with my code but it always gives me the error saying

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

Help is greatly needed!!

Here’s the direct translation of that error:
“ey man your code has errors.”

We need to see the code itself (and the log would be appreciated)

1 Like

@Deicer I am new to this and I also am not very good at programming so my code is bad, please don’t judge :grinning:
This is 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)]
// Arm                  motor         5               
// Tilter               motor         7               
// LeftIntake           motor         3               
// RightIntake          motor         4               
// RightFront           motor         9               
// RightBack            motor         10              
// LeftFront            motor         6               
// LeftBack             motor         8               
// ---- END VEXCODE CONFIGURED DEVICES ----

#include "vex.h"

using namespace vex;

// A global instance of competition
competition Competition;

vex::brain       Brain;
vex::controller Controller1 = vex::controller();
vex::motor Arm( PORT5, vex::gearSetting::ratio36_1,false );
vex::motor Tilter( PORT7, vex::gearSetting::ratio36_1, false );
vex::motor LeftIntake( PORT3, vex::gearSetting::ratio36_1, false );
vex::motor RightIntake( PORT4, vex::gearSetting::ratio36_1, true );
vex::motor RightFront( PORT9, vex::gearSetting::ratio18_1, true );
vex::motor RightBack( PORT10, vex::gearSetting::ratio18_1, true );
vex::motor LeftFront( PORT6, vex::gearSetting::ratio18_1, false );
vex::motor LeftBack( PORT8, vex::gearSetting::ratio18_1, false );


// 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();
 
 Arm.resetRotation();
 Tilter.resetRotation();
LeftIntake.resetRotation();
RightIntake.resetRotation();
RightFront.resetRotation();
RightBack.resetRotation();
LeftFront.resetRotation();
LeftBack.resetRotation();  



  // 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) 
{
  int RightFrontSpeedPCT = 200;
 int RightBackSpeedPCT = 200;
 int LeftFrontSpeedPCT = 200;
int LeftBackSpeedPCT = 200;
  int ArmSpeedPCT = 50;
  int TilterSpeedPCT = 15;
  int RightIntakeSpeedPCT = 100;
  int LeftIntakeSpeedPCT = 100;

    
    
    
    
    
    RightFront.spin(vex::directionType::fwd, RightFrontSpeedPCT, vex::velocityUnits::pct);
    RightBack.spin(vex::directionType::fwd, RightBackSpeedPCT, vex::velocityUnits::pct);
    LeftFront.spin(vex::directionType::fwd, LeftFrontSpeedPCT, vex::velocityUnits::pct);
    LeftBack.spin(vex::directionType::fwd, LeftBackSpeedPCT, vex::velocityUnits::pct);
    LeftIntake.spin(vex::directionType::rev, LeftIntakeSpeedPCT, vex::velocityUnits::pct);
    RightIntake.spin(vex::directionType::rev, RightIntakeSpeedPCT, vex::velocityUnits::pct);
    task::sleep(2000);

}

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*                              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) 
{
   int ArmSpeedPCT = 50;
    int TilterSpeedPCT = 10;
    int RightIntakeSpeedPCT = 100;
    int LeftIntakeSpeedPCT = 100;
  while (1) {
   //Drive Control
        //Set the left and right motor to spin forward using the controller Axis values as the velocity value.
        LeftFront.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
        LeftBack.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
        RightFront.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);
        RightBack.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);
        
        //arm controls
        if(Controller1.ButtonL1.pressing()) 
        { 
            Arm.spin(vex::directionType::fwd, ArmSpeedPCT, vex::velocityUnits::pct);
        }
        else if(Controller1.ButtonL2.pressing()) 
        { 
            Arm.spin(vex::directionType::rev, ArmSpeedPCT, vex::velocityUnits::pct);
        }
        else 
        { 
            Arm.stop(vex::brakeType::brake);
        }
        
        //Tilter controls 
        if(Controller1.ButtonLeft.pressing()) 
        { 
            Tilter.spin(vex::directionType::fwd, TilterSpeedPCT, vex::velocityUnits::pct);
        }
        else if(Controller1.ButtonDown.pressing()) 
        { 
            Tilter.spin(vex::directionType::rev, TilterSpeedPCT, vex::velocityUnits::pct);
        }
        else 
        { 
            Tilter.stop(vex::brakeType::brake);        
        }
        
        //Left and Right Intale code
        if(Controller1.ButtonR1.pressing()) 
        { 
            LeftIntake.spin(vex::directionType::fwd, LeftIntakeSpeedPCT, vex::velocityUnits::pct);
        }
        else if(Controller1.ButtonR2.pressing()) 
        { 
            LeftIntake.spin(vex::directionType::rev, LeftIntakeSpeedPCT, vex::velocityUnits::pct);
        }
        else 
        { 
            LeftIntake.stop(vex::brakeType::hold);        
        }
      
        
        if(Controller1.ButtonR1.pressing()) 
        { 
            RightIntake.spin(vex::directionType::fwd, RightIntakeSpeedPCT, vex::velocityUnits::pct);
        }
        else if(Controller1.ButtonR2.pressing()) 
        { 
            RightIntake.spin(vex::directionType::rev, RightIntakeSpeedPCT, vex::velocityUnits::pct);
        }
        else 
        { 
            RightIntake.stop(vex::brakeType::hold);        
        }


    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);
  }
}

This is the log (I think)
code%20error

At least one of your errors is because of your brain declaration. It’s done automatically in ‘robot-config.cpp’ (Which is a pain for people who already made their declarations but oh well…)

Solution: delete line 30 in your code or remove it from the robot-config.cpp file
vex::brain Brain;

The rest of those errors I’m not getting when I copied your code so I can’t be sure, but it looks to me like you went in and added your devices through the graphical robot config. This means your declarations (lines 30-39) are already in ‘robot-config.cpp’ as well.

Solution: delete all of your declarations in your code OR delete your devices from the graphical config

EDIT: I forgot to explain why you have to do this :neutral_face:
Essentially you can only define devices once or the brain gets confused when you call multiple devices simultaneously by the same name

3 Likes

I did what you said to do and it worked!! Thank you!! Ohhh that makes sense.

2 Likes