collect2.exe: fatal error: cannot find 'ld'

CAN SOMEONE PLEASE HELP ME ASAP! I NEED HELP WITH MY COMPILATION OF SKETCH. I HAVE RE-INSTALLED THE ARDUINO IDE, BUT STILL THE SAME PROBLEM OCCUR.
IT STATES: collect2.exe: fatal error: cannot find 'ld'

HERE IS MY CODE:
#define BLYNK_PRINT DebugSerial
// You could use a spare Hardware Serial on boards that have it (like Mega)

#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX

#include <Arduino.h>
#include <Keypad.h>
#include <Keypad.h>
#include <BlynkSimpleStream.h>
#include <SimpleTimer.h>
int ledPin = 13; //Red
int ledPin2 = 12; //Green
int ledPin3 = 11; //Red
int ledPin4 = 10; //Green
int ledPin5 = 9; //Red
int ledPin6 = 8; //Green
int ledPin7 = 7; //Red
int ledPin8 = 6; //Green
int buzzPin = 4;
int inputPin = 2; // choose the input pin (for PIR sensor)
int inputPin2 = 3; // choose the input pin (for PIR sensor)
int pirState = 0; // we start, assuming no motion detected
int val = 0; // variable for reading the pin status
bool buzz = false;

//---------------------------------------------------------------------------------------//

#include <BlynkSimpleStream.h>
SimpleTimer timer;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "cdee5c19433143638b64809d2bfa187c";

//Attach termnal widget
WidgetTerminal terminal(V1);

void setup()
{
// Debug console
DebugSerial.begin(9600);

// Blynk will work through Serial
// Do not read or write this serial manually in your sketch
Serial.begin(9600);
Blynk.begin(Serial, auth);

pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
pinMode(ledPin5, OUTPUT); // declare LED as output
pinMode(ledPin6, OUTPUT);
pinMode(ledPin7, OUTPUT);
pinMode(ledPin8, OUTPUT);
pinMode(inputPin, INPUT); // declare sensor as input
pinMode(inputPin2, INPUT); // declare sensor as input
pinMode(buzzPin, OUTPUT); //declare buzzer as output

//keypad listener//
/keypad.addEventListener(keypadEvent);/

timer.setInterval(100, activate);
}

void loop()
{
Blynk.run();
timer.run();

}

BLYNK_WRITE(V2) {
int x = param.asInt();
if (x == 1) {
pirState = 1;
buzz = true;
Blynk.notify("System activate");
digitalWrite(ledPin2, HIGH);
digitalWrite(ledPin4, HIGH);
digitalWrite(ledPin6, HIGH);
digitalWrite(ledPin8, HIGH);
noTone(buzzPin);
activate();
} else {
pirState = 0;
buzz = false;
digitalWrite(ledPin, LOW);
digitalWrite(ledPin2, HIGH);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, HIGH);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, HIGH);
digitalWrite(ledPin8, LOW);
digitalWrite(inputPin, LOW);
digitalWrite(inputPin2, LOW);
noTone(buzzPin);
Blynk.notify("System deactivated");
}
}

void activate() {
// read input value
val = digitalRead(inputPin);
val = digitalRead(inputPin2);
if ((val == HIGH) && (pirState == 1) && (buzz == true)) { // check if the input is HIGH
//keypad.getKey();//
digitalWrite(ledPin, HIGH); // turn LED ON
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, HIGH); // turn LED ON
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin5, HIGH); // turn LED ON
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, HIGH); // turn LED ON
digitalWrite(ledPin8, LOW);
digitalWrite(buzzPin, HIGH);

Blynk.notify("Motion detected!");
Blynk.email("smarthomegateway.97b@gmail.com", "INTRUDER ALERT!", "SOMEONE IS TRYING TO BREAK IN!");
terminal.println("Motion detected, please enter password to deactivate the alarm");
delay(10000);
terminal.flush();
}
}

BLYNK_WRITE(V1) {
if (String("123") == param.asStr()) {
val = LOW;
digitalWrite(ledPin, LOW);
digitalWrite(ledPin2, HIGH);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, HIGH);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, HIGH);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin8, HIGH);
noTone(buzzPin);
terminal.println("Alarm off!");
} else {
terminal.println("Password invalid!");
terminal.println("Please retry");
delay(1000);
}
terminal.flush();
}

PLEASE HELP!

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn't show the posting toolbar then you can just manually add the code tags:
[code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.

When your code requires a library that's not included with the Arduino IDE please always post a link (using the chain link icon on the toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger(Sketch > Include Library > Manage Libraries) then say so and state the full name of the library.

When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here USING CODE TAGS (</> button on the toolbar).

Sounds like a corrupted install. On my Win8 system, ld (ld.exe) can be found in C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\bin

Did it work before?

I have the same problem. Kept on uninstalling and reinstalling and there was no solution. Quit my antivirus, same problem. I don't know what's wrong. Hope someone could help.

//Tutorial: https://www.youtube.com/watch?v=kmf8ZfWdGU4

#include <IRremote.h>
#include <EEPROM.h>
#define SAMPLE_TIME 2000;  //The time between each EEPROM write function c

IRrecv receiver(2); // receiver is connected to pin2
IRsend sender;
decode_results results;

unsigned long timer;
float conv_coeff = 0.0; //coefficient for converting 0-1300 to 0-5
long repetitions;
long count;
unsigned int durations[100];
void writenumber();
void (*reset)(void) = 0;
int address=0;

void setup() {
  Serial.begin(9600);
  conv_coeff = 5.0 / 1400.0;
  timer = millis();
  receiver.enableIRIn(); // start receiving signals
}

void loop() {

  // check if a decoded infrared signal is available
  if (receiver.decode(&results)) {
    int address = 0; //EEPROM address counter
    Serial.println(results.value, HEX);
    Serial.print(results.rawlen - 1);
    for (int i = 1; i < results.rawlen; i++) {
      unsigned int number = results.rawbuf[i] * USECPERTICK;
      Serial.print(",");
      Serial.print(number);
    }
    Serial.print("");
    writenumber();
    timer = millis();
    receiver.resume();
  }
  

}



void writenumber()
{
  for (int i = 1; i < results.rawlen; i++) {
    int address = 0;
    unsigned int number = results.rawbuf[i] * USECPERTICK;
    byte value = number * conv_coeff;
    EEPROM.write(address, value);
    Serial.print("sensor value stored at address ");
    Serial.println(address);

    address++; //increment address counter
    if (address == EEPROM.length())
    {
      address = 0;
    }

  }
}
Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

Archiving built core (caching) in: C:\Users\moo\AppData\Local\Temp\arduino_cache_590339\core\core_arduino_avr_uno_ad498f47f274213150f9913632d09114.a
collect2.exe: fatal error: cannot find 'ld'

compilation terminated.

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

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Here's my error code. It shows the same thing no matter what code I put in, including the built-in examples.

chadmoo96:

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

Archiving built core (caching) in: C:\Users\moo\AppData\Local\Temp\arduino_cache_590339\core\core_arduino_avr_uno_ad498f47f274213150f9913632d09114.a
collect2.exe: fatal error: cannot find 'ld'

compilation terminated.

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

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.




Here's my error code. It shows the same thing no matter what code I put in, including the built-in examples.

Reply #2 provides some info where ld.exe should be.