Problem when compiling, error: ld returned 1 exit status

Hello everyone,
As I try to compile my sketch I get the following error message:


c:/program files (x86)/arduino/hardware/tools/avr/bin/…/lib/gcc/avr/4.9.2/…/…/…/…/avr/lib/avr5/crtatmega328p.o:(.init9+0x0): undefined reference to `main’

collect2.exe: error: ld returned 1 exit status

Using library SoftwareSerial at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial
exit status 1

I have had no luck searching for errors “undefined reference to `main’” or “ld returned 1 exit status”.

Any suggestions?

My sketch:

#include <SoftwareSerial.h>

SoftwareSerial serial1(10, 11); // RX, TX

int readBluetooth;//Variável que irá receber o valor enviado do celular para o Bluetooth
int lamp=13;//LED da porta 13
 
void setup(){
   Serial.begin(9600);//Inicia comunicação serial
   pinMode(lamp,OUTPUT);//Definindo o pino 13 como saída
}
 
void loop(){
    if(Serial.available()>0){//Verifica se algo chegou via Bluetooth
    readBluetooth = Serial.read(); //Grava esse algo lido na variavel
    if(readBluetooth == '3'){
           digitalWrite(lamp,!digitalRead(lamp));//Alterna estado do LED
     }else{
      if(readBluetooth == '5'){
        delay(250);
        Serial.write(digitalRead(lamp)); //Checa estado do LED
      }
     }
   }
}

Try closing all Arduino IDE windows and then restart the Arduino IDE. This will clear the cache and hopefully solve the problem.