exit status 1 Error compiling for board Arduino/Genuino Uno.

I'm trying to help my friends daughter make a robot that will generate random numbers to make it go on different paths the code compiles when I test it without an uno plugged into my PC but when the uno is plugged in it generates the error stated in the subject line. I'm wondering if the uno just doesn't support my functions or if the random number generators are too much for it.
Thank you in advanced for any help I will be checking back in hourly to see if any replies are made. I must get this code working before 12:00 PM tomorrow (Wednesday, January 24, 2018).

Here's the code.

int MtrL = 3;           // motor PWM 500Hz with duty cycle control
int MtrR = 5;          // R motor PWM
int MtrLF = 2;         // motor L Forward direction
int MtrRF= 4;         // motor R Forward direction
int MtrLR = 6;        // motor L reverse direction
int MtrRR = 7;         // motor R reverse direction
int pattern = 0;      // random number generator for path style
int Lpwm = 0;         // random number generator for L motor pwm
int Rpwm = 0;         // random number generator for R motor pwm
int Time = 0;         // random number generator for delays


// the setup routine runs once when you press reset:
void setup() {

  pinMode(MtrL, OUTPUT);   //PWM to H Bridge L motor
  pinMode(MtrR, OUTPUT);   //PWM to H Bridge R motor
  pinMode(MtrLF, OUTPUT);    // fwd signal to H Bridge L motor
  pinMode(MtrRF, OUTPUT);   // fwd signal to H Bridge R motor
  pinMode(MtrLR, OUTPUT);    // Rev signal to H Bridge L motor
  pinMode(MtrRR, OUTPUT);   // Rev signal to H Bridge R motor

  delay(5000);   // delay after being powered to clear the workspace
}

// the loop routine runs over and over again forever:
void loop() {

  pattern = random (1,8);     // random number generator for path style
  Lpwm = random (125,255);    // random number generator for L motor pwm
  Rpwm = random (125,255);    // random number generator for R motor pwm
  Time = random (2000,10000); // random number generator for delays

 if(pattern = 1){           // straight line forwards
  OnePWM(Lpwm);  // controls 500Hz PWM waveform duty cycle 0-255, 127=50% DC therefore 1/2 speed note never run motors below 50% duty cycle
  Forward();                // function to make both motors move forward
  }
  
 if(pattern = 2){           // straight line backwards
  OnePWM(Lpwm);  // controls 500Hz PWM waveform duty cycle 0-255, 127=50% DC therefore 1/2 speed note never run motors below 50% duty cycle
  Backward();               // function to make both motors move Backward
  }

  if(pattern = 3){           // straight line backwards
  OnePWM(Lpwm);  // controls 500Hz PWM waveform duty cycle 0-255, 127=50% DC therefore 1/2 speed note never run motors below 50% duty cycle
  OppositeL();              //both motors move opposite directions Left going forward
  }

  if(pattern = 4){           // straight line backwards
  OnePWM(Lpwm);  // controls 500Hz PWM waveform duty cycle 0-255, 127=50% DC therefore 1/2 speed note never run motors below 50% duty cycle
  OppositeR();              //both motors move opposite directions Right going forward
  }

  if(pattern = 5){           // slight turn forwards
  TwoPWM(Lpwm, Rpwm);  // controls 500Hz PWM waveform duty cycle 0-255, 127=50% DC therefore 1/2 speed note never run motors below 50% duty cycle
  Forward();                // function to make both motors move forward
  }

  if(pattern = 6){           // slight turn backwards
  TwoPWM(Lpwm, Rpwm);  // controls 500Hz PWM waveform duty cycle 0-255, 127=50% DC therefore 1/2 speed note never run motors below 50% duty cycle
  Backward();                // function to make both motors move backward
  }

  if(pattern = 7){           // Sharp turn opposite motors left forwards
  TwoPWM(Lpwm, Rpwm);  // controls 500Hz PWM waveform duty cycle 0-255, 127=50% DC therefore 1/2 speed note never run motors below 50% duty cycle
  OppositeL();                //both motors move opposite directions Left going forward
  }

  if(pattern = 8){           // Sharp turn opposite motors left forwards
  TwoPWM(Lpwm, Rpwm);  // controls 500Hz PWM waveform duty cycle 0-255, 127=50% DC therefore //1/2 speed note never run motors below 50% duty cycle
  OppositeR();                //both motors move opposite directions Right going forward
  }

  delay (Time); //time spent to perform movement
}

// functions

void OnePWM(int left) //controls PWM for Patterns 1-4
{
  analogWrite(MtrR, left);  // controls 500Hz PWM waveform duty cycle 0-255, 127=50% DC therefore 1/2 speed note never run motors below 50% duty cycle
  analogWrite(MtrL, left);  // controls 500Hz PWM waveform duty cycle 0-255, 127=50% DC therefore 1/2 speed note never run motors below 50% duty cycle
}

void TwoPWM(int left, int right) //controls PWM for Patterns 5-8
{
  analogWrite(MtrR, left);  // controls 500Hz PWM waveform duty cycle 0-255, 127=50% DC therefore 1/2 speed note never run motors below 50% duty cycle
  analogWrite(MtrL, right);  // controls 500Hz PWM waveform duty cycle 0-255, 127=50% DC therefore 1/2 speed note never run motors below 50% duty cycle
}

void Forward() //both motors move forward
{
  digitalWrite(MtrLF,HIGH); //Controls L Motor forward Direction
  digitalWrite(MtrRF,HIGH); //Controls R Motor forward Direction
  digitalWrite(MtrLR,LOW); //Controls L Motor reverse Direction
  digitalWrite(MtrRR,LOW); //Controls R Motor reverse Direction
}

void Backward() //both motors move backward
{
  digitalWrite(MtrLF,LOW); //Controls L Motor forward Direction
  digitalWrite(MtrRF,LOW); //Controls R Motor forward Direction
  digitalWrite(MtrLR,HIGH); //Controls L Motor reverse Direction
  digitalWrite(MtrRR,HIGH); //Controls R Motor reverse Direction
}

void OppositeL() //both motors move opposite directions Left going forward
{
  digitalWrite(MtrLF,HIGH); //Controls L Motor forward Direction
  digitalWrite(MtrRF,LOW); //Controls R Motor forward Direction
  digitalWrite(MtrLR,LOW); //Controls L Motor reverse Direction
  digitalWrite(MtrRR,HIGH); //Controls R Motor reverse Direction
}

void OppositeR() //both motors move opposite directions Right going forward
{
  digitalWrite(MtrLF,LOW); //Controls L Motor forward Direction
  digitalWrite(MtrRF,HIGH); //Controls R Motor forward Direction
  digitalWrite(MtrLR,HIGH); //Controls L Motor reverse Direction
  digitalWrite(MtrRR,LOW); //Controls R Motor reverse Direction
}

the code compiles when I test it without an uno plugged into my PC but when the uno is plugged in it generates the error stated in the subject line.

Your code compiles and uploads correctly for me using ide 1.8.5 under Windows 10.

Have you selected the correct board and com port from the tools menu?

= or ==?

if(pattern = 1){

Cattledog did you test the code with an uno attached?

I searched in another forum and found that if verbrose is turned on it should show the error message so here's what I found and it isn't making much sense because this stuff was declared. I hope it will help anyone helping me with this issue. Thanks again.

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c: In function 'setup':

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c:16:17: error: 'OUTPUT' undeclared (first use in this function)

pinMode(MtrL, OUTPUT); //PWM to H Bridge L motor

^

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c:16:17: note: each undeclared identifier is reported only once for each function it appears in

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c: In function 'Forward':

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c:93:22: error: 'HIGH' undeclared (first use in this function)

digitalWrite(MtrLF,HIGH); //Controls L Motor forward Direction

^

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c:95:22: error: 'LOW' undeclared (first use in this function)

digitalWrite(MtrLR,LOW); //Controls L Motor reverse Direction

^

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c: In function 'Backward':

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c:101:22: error: 'LOW' undeclared (first use in this function)

digitalWrite(MtrLF,LOW); //Controls L Motor forward Direction

^

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c:103:22: error: 'HIGH' undeclared (first use in this function)

digitalWrite(MtrLR,HIGH); //Controls L Motor reverse Direction

^

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c: In function 'OppositeL':

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c:109:22: error: 'HIGH' undeclared (first use in this function)

digitalWrite(MtrLF,HIGH); //Controls L Motor forward Direction

^

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c:110:22: error: 'LOW' undeclared (first use in this function)

digitalWrite(MtrRF,LOW); //Controls R Motor forward Direction

^

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c: In function 'OppositeR':

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c:117:22: error: 'LOW' undeclared (first use in this function)

digitalWrite(MtrLF,LOW); //Controls L Motor forward Direction

^

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c:118:22: error: 'HIGH' undeclared (first use in this function)

digitalWrite(MtrRF,HIGH); //Controls R Motor forward Direction

Cattledog did you test the code with an uno attached?

Yes. uploads == downloads

Your code compiles and uploads correctly for me using ide 1.8.5 under Windows 10.

C:\Users\Ian\AppData\Local\Temp\arduino_build_567998\sketch\Printable code copy.c

.c? The IDE converts the .ino file to a .cpp file. What are you compiling?

I'm going to close this page I'm guessing that there was a save error because after copying and pasting to a new IDE the code worked.

You can add .c files to a sketch if you like but the HIGH, LOW, OUTPUT, etc. macros are defined in Arduino.h. Before compiling the Arduino IDE automatically adds this line:

#include <Arduino.h>

to your .ino file but it does not do this for files with other extensions. Thus if you need any of the components of the Arduino core library you need to include them yourself in those files.