What does exit status 1 mean?

I'm working on some code but I keep on getting the error message exit status 1. My code is as follows:

const int REDPIN = 3;
const int GREENPIN = 5;
const int BLUEPIN = 7;
const int BUTTONPIN = 8;
int KNOB1 = 0;
int KNOB2 = 0;
int RED = 0;
int GREEN = 0;
int BUTTON = 0;

void setup() {
  // put your setup code here, to run once:

void loop() {
  // put your main code here, to run repeatedly:
KNOB1 = analogRead(A0);
KNOB2 = analogRead(A1);
RED = map(KNOB1, 1, 1023, 1, 255);
GREEN = map(KNOB2, 1, 1023, 1, 255);
analogWrite(REDPIN, RED);
analogWrite(GREENPIN, GREEN);
if (digitalRead(BUTTONPIN) == LOW && BUTTON == 0) {
  digitalWrite(BLUEPIN, HIGH);
  BUTTON = 1;
} else if (digitalRead(BUTTONPIN == LOW && BUTTON == 1)) {
  digitalWrite(BLUEPIN, LOW);
  BUTTON = 0;

I read on a different post that if you change your preferences to verbose output for compiling and uploading and that seemed to work for that person but for me I just got a much longer error message that didn't tell me anything and ended in:

collect2.exe: error: ld returned 1 exit status

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

Does anyone know how to fix my code?

Always show the whole error message.

Does this look right :wink:
digitalRead(BUTTONPIN == LOW && BUTTON == 1)


This is the message that I get when I compile it

Sketch uses 1,956 bytes (6%) of program storage space. Maximum is 32,256 bytes.
Global variables use 21 bytes (1%) of dynamic memory, leaving 2,027 bytes for local variables. Maximum is 2,048 bytes.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you're using the Arduino Web Editor you will not have access to this useful tool but it's still unacceptable to post poorly formatted code. I recommend you to use the standard IDE instead.

I just got a much longer error message that didn't tell me anything

Actually I'm certain it told you lots of things. Maybe you didn't understand all of them. Actually I recommend that you not turn on verbose output during compilation because it just adds a lot of extra output that's rarely useful and makes it harder to find the important information. It also makes it more likely that the output will exceed the forum's 9000 character limit which will prevent you from posting it directly in a forum message. In the rare case where we do need verbose compilation output we'll ask for it. However, I do recommend that you always leave verbose output during upload on because it's nice to see the progress of the upload and the non-verbose upload output is very unhelpful when you have an upload error.

It compiles without errors on IDE 1.8.0.

Are you running the Windows Store version of the IDE for a version of the IDE before 1.8.3, or using Windows XP on a version between 1.6.x and 1.8.3?

If so, and if there are no other compiler errors, that's the linker bug that got fixed in 1.8.3 or 1.8.4

Thanks larryd, I didn't spot that! As soon as I fixed that bug it worked!