error: make process closed with Exit Code:2

Hi there. Im new at coding and tried to Download the following Code to my vex v5 Brain. However appears every time the exit code and another (older) programm runs on the Slot wich I haven‘t selected.
Pls help me

/*----------------------------------------------------------------------------*/
/*                                                                            */
/*    Module:       main.cpp                                                  */
/*    Author:       Konrad                                                    */
/*    Created:      1/1/2025, 4:09:38 PM                                      */
/*    Description:  V5 project                                                */
/*                                                                            */
/*----------------------------------------------------------------------------*/

#include "vex.h"

using namespace vex;

// A global instance of competition
competition Competition;

// VEXcode device constructors
brain Brain;

// Drivetrain
motor LFDrive = motor (PORT20, ratio18_1, false);
motor RFDrive = motor (PORT11, ratio18_1, true);
motor LBDrive = motor (PORT19, ratio18_1, false);
motor RBDrive = motor (PORT17, ratio18_1, true);

// floatband
motor floatband1 = motor (PORT16, ratio18_1,false);
motor floatband2 = motor (PORT9, ratio18_1,false);

// leverdown
motor leverdown = motor (PORT14, ratio18_1, false);

// arm
motor arm1 = motor (PORT15, ratio18_1, false);
motor arm2 = motor (PORT13, ratio18_1, true);

// controller
controller Controller1 = controller(primary);

// 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 axisthreechanged() {
  LFDrive.spin(forward, Controller1.Axis3.value() * 0.5, pct);
  LBDrive.spin(forward, Controller1.Axis3.value() * 0.5, pct);
  RFDrive.spin(forward, Controller1.Axis3.value() * 0.5, pct);
  RBDrive.spin(forward, Controller1.Axis3.value() * 0.5, pct);
  
}

void axisonechanged() {
  LFDrive.spin(forward, Controller1.Axis4.value() * 0.5, pct);
  LBDrive.spin(reverse, Controller1.Axis4.value() * 0.5, pct);
  RFDrive.spin(reverse, Controller1.Axis4.value() * 0.5, pct);
  RBDrive.spin(forward, Controller1.Axis4.value() * 0.5, pct);
}

void floatbandfor() {
  floatband1.setVelocity(100, pct);
  floatband1.spin(forward);
  floatband2.setVelocity(100, pct);
  floatband2.spin(forward);
}

void floatbandback() {
  floatband1.setVelocity(100, pct);
  floatband1.spin(reverse);
  floatband2.setVelocity(100, pct);
  floatband2.spin(reverse);
}

void leverdownvoid() {
  leverdown.spinToPosition(20, degrees);
}

void leverupvoid() {
  leverdown.spinToPosition(150, degrees);
}

void armdown() {
  arm1.spinToPosition(0, degrees);
  arm2.spinToPosition(0, degrees);
}

void armbasic() {
  arm1.spinToPosition(90, degrees);
  arm2.spinToPosition(90, degrees);
}



void pre_auton(void) {

  // 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.
  // ..........................................................................
}

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*                              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
  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.
    // ........................................................................

    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);
  
  Controller1.ButtonR1.pressed(floatbandfor);
  Controller1.ButtonR2.pressed(floatbandback);

  Controller1.Axis1.changed(axisonechanged);
  Controller1.Axis3.changed(axisthreechanged);
    
  Controller1.ButtonDown.pressed(leverdownvoid);
  Controller1.ButtonUp.pressed(leverupvoid);

  Controller1.ButtonA.pressed();
  Controller1.ButtonB.pressed();
  Controller1.ButtonX.pressed();

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

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

edit: code tags added by mods, please remember to use them.

When you have errors in the code building will fail. The errors usually tell you what’s wrong.
For your code this is shown

unix build for platform vexv5 on Darwin x86_64
CXX src/main.cpp
src/main.cpp:167:31: error: too few arguments to function call, single argument 'callback' was not specified
  Controller1.ButtonA.pressed();
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/james/Library/Application Support/Code/User/globalStorage/vexrobotics.vexcode/sdk/cpp/V5/V5_20240802_15_00_00/vexv5/include/vex_controller.h:136:11: note: 'pressed' declared here
          void     pressed( void (* callback)(void) ) const;
          ^
src/main.cpp:168:31: error: too few arguments to function call, single argument 'callback' was not specified
  Controller1.ButtonB.pressed();
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/james/Library/Application Support/Code/User/globalStorage/vexrobotics.vexcode/sdk/cpp/V5/V5_20240802_15_00_00/vexv5/include/vex_controller.h:136:11: note: 'pressed' declared here
          void     pressed( void (* callback)(void) ) const;
          ^
src/main.cpp:169:31: error: too few arguments to function call, single argument 'callback' was not specified
  Controller1.ButtonX.pressed();
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/james/Library/Application Support/Code/User/globalStorage/vexrobotics.vexcode/sdk/cpp/V5/V5_20240802_15_00_00/vexv5/include/vex_controller.h:136:11: note: 'pressed' declared here
          void     pressed( void (* callback)(void) ) const;
          ^
3 errors generated.

make: *** [build/src/main.o] Error 1

Make process closed with exit code: 2

It’s telling you these lines of code are being used incorrectly.

  Controller1.ButtonA.pressed();
  Controller1.ButtonB.pressed();
  Controller1.ButtonX.pressed();
3 Likes