Error compiling for board Arduino Uno: IR_Receiver_Module

Hello. I am very new to Arduino and I have the Elegoo Uno R3. it came with some pre written code to test out everything. I was going through them one by one when the IR_Receiver_Module code did not work. here are the error messages:

Arduino: 1.8.19 (Windows 10), Board: "Arduino Uno"

C:\Users\USER\AppData\Local\Temp\ccTcpGiv.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_IR_Receiver_Module.ino.cpp.o.1762':

:(.text.startup+0x60): undefined reference to `IRrecv::IRrecv(int)'

C:\Users\USER\AppData\Local\Temp\ccTcpGiv.ltrans0.ltrans.o: In function `setup':

C:\Users\USER\Downloads\ELEGOO The Most Complete Starter Kit for UNO V1.0.2021.05.13\English\code\Lesson 14 IR Receiver Module\IR_Receiver_Module/IR_Receiver_Module.ino:58: undefined reference to `IRrecv::enableIRIn()'

C:\Users\USER\AppData\Local\Temp\ccTcpGiv.ltrans0.ltrans.o: In function `loop':

C:\Users\USER\Downloads\ELEGOO The Most Complete Starter Kit for UNO V1.0.2021.05.13\English\code\Lesson 14 IR Receiver Module\IR_Receiver_Module/IR_Receiver_Module.ino:65: undefined reference to `IRrecv::decode(decode_results*)'

C:\Users\USER\Downloads\ELEGOO The Most Complete Starter Kit for UNO V1.0.2021.05.13\English\code\Lesson 14 IR Receiver Module\IR_Receiver_Module/IR_Receiver_Module.ino:69: undefined reference to `IRrecv::resume()'

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board Arduino Uno.

Anything I can do? Most of the help i get comes from these forums. Thanks!

Post the code that generated that error. Read the forum guidelines to see how to properly post code and some good information on making a good post.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

What version of the IDE are you using?

Looks like the IRremote library isn't fully installed.

Here is the code:

#include "IRremote.h"

int receiver = 11; // Signal Pin of IR receiver to Arduino Digital Pin 11

/*-----( Declare objects )-----*/
IRrecv irrecv(receiver);     // create instance of 'irrecv'
decode_results results;      // create instance of 'decode_results'

/*-----( Function )-----*/
void translateIR() // takes action based on IR code received

// describing Remote IR codes 

{

  switch(results.value)

  {
  case 0xFFA25D: Serial.println("POWER"); break;
  case 0xFFE21D: Serial.println("FUNC/STOP"); break;
  case 0xFF629D: Serial.println("VOL+"); break;
  case 0xFF22DD: Serial.println("FAST BACK");    break;
  case 0xFF02FD: Serial.println("PAUSE");    break;
  case 0xFFC23D: Serial.println("FAST FORWARD");   break;
  case 0xFFE01F: Serial.println("DOWN");    break;
  case 0xFFA857: Serial.println("VOL-");    break;
  case 0xFF906F: Serial.println("UP");    break;
  case 0xFF9867: Serial.println("EQ");    break;
  case 0xFFB04F: Serial.println("ST/REPT");    break;
  case 0xFF6897: Serial.println("0");    break;
  case 0xFF30CF: Serial.println("1");    break;
  case 0xFF18E7: Serial.println("2");    break;
  case 0xFF7A85: Serial.println("3");    break;
  case 0xFF10EF: Serial.println("4");    break;
  case 0xFF38C7: Serial.println("5");    break;
  case 0xFF5AA5: Serial.println("6");    break;
  case 0xFF42BD: Serial.println("7");    break;
  case 0xFF4AB5: Serial.println("8");    break;
  case 0xFF52AD: Serial.println("9");    break;
  case 0xFFFFFFFF: Serial.println(" REPEAT");break;  

  default: 
    Serial.println(" other button   ");

  }// End Case

  delay(500); // Do not get immediate repeat


} //END translateIR
void setup()   /*----( SETUP: RUNS ONCE )----*/
{
  Serial.begin(9600);
  Serial.println("IR Receiver Button Decode"); 
  irrecv.enableIRIn(); // Start the receiver

}/*--(end setup )---*/


void loop()   /*----( LOOP: RUNS CONSTANTLY )----*/
{
  if (irrecv.decode(&results)) // have we received an IR signal?

  {
    translateIR(); 
    irrecv.resume(); // receive the next value
  }  
}/* --(end main loop )-- */

Here is IRremote.h:

#ifndef IRremote_h
#define IRremote_h

// The following are compile-time library options.
// If you change them, recompile the library.
// If DEBUG is defined, a lot of debugging output will be printed during decoding.
// TEST must be defined for the IRtest unittests to work.  It will make some
// methods virtual, which will be slightly slower, which is why it is optional.
// #define DEBUG
// #define TEST

// Results returned from the decoder
class decode_results {
public:
  int decode_type; // NEC, SONY, RC5, UNKNOWN
  union { // This is used for decoding Panasonic and Sharp data
    unsigned int panasonicAddress;
    unsigned int sharpAddress;
  };
  unsigned long value; // Decoded value
  int bits; // Number of bits in decoded value
  volatile unsigned int *rawbuf; // Raw intervals in .5 us ticks
  int rawlen; // Number of records in rawbuf.
};

// Values for decode_type
#define NEC 1
#define SONY 2
#define RC5 3
#define RC6 4
#define DISH 5
#define SHARP 6
#define PANASONIC 7
#define JVC 8
#define SANYO 9
#define MITSUBISHI 10
#define SAMSUNG 11
#define LG 12
#define UNKNOWN -1

// Decoded value for NEC when a repeat code is received
#define REPEAT 0xffffffff

// main class for receiving IR
class IRrecv
{
public:
  IRrecv(int recvpin);
  void blink13(int blinkflag);
  int decode(decode_results *results);
  void enableIRIn();
  void resume();
private:
  // These are called by decode
  int getRClevel(decode_results *results, int *offset, int *used, int t1);
  long decodeNEC(decode_results *results);
  long decodeSony(decode_results *results);
  long decodeSanyo(decode_results *results);
  long decodeMitsubishi(decode_results *results);
  long decodeRC5(decode_results *results);
  long decodeRC6(decode_results *results);
  long decodePanasonic(decode_results *results);
  long decodeLG(decode_results *results);
  long decodeJVC(decode_results *results);
  long decodeSAMSUNG(decode_results *results);
  long decodeHash(decode_results *results);
  int compare(unsigned int oldval, unsigned int newval);

} 
;

// Only used for testing; can remove virtual for shorter code
#ifdef TEST
#define VIRTUAL virtual
#else
#define VIRTUAL
#endif

class IRsend
{
public:
  IRsend() {}
  void sendNEC(unsigned long data, int nbits);
  void sendSony(unsigned long data, int nbits);
  // Neither Sanyo nor Mitsubishi send is implemented yet
  //  void sendSanyo(unsigned long data, int nbits);
  //  void sendMitsubishi(unsigned long data, int nbits);
  void sendRaw(unsigned int buf[], int len, int hz);
  void sendRC5(unsigned long data, int nbits);
  void sendRC6(unsigned long data, int nbits);
  void sendDISH(unsigned long data, int nbits);
  void sendSharp(unsigned int address, unsigned int command);
  void sendSharpRaw(unsigned long data, int nbits);
  void sendPanasonic(unsigned int address, unsigned long data);
  void sendJVC(unsigned long data, int nbits, int repeat); // *Note instead of sending the REPEAT constant if you want the JVC repeat signal sent, send the original code value and change the repeat argument from 0 to 1. JVC protocol repeats by skipping the header NOT by sending a separate code value like NEC does.
  // private:
  void sendSAMSUNG(unsigned long data, int nbits);
  void enableIROut(int khz);
  VIRTUAL void mark(int usec);
  VIRTUAL void space(int usec);
}
;

// Some useful constants

#define USECPERTICK 50  // microseconds per clock interrupt tick
#define RAWBUF 100 // Length of raw duration buffer

// Marks tend to be 100us too long, and spaces 100us too short
// when received due to sensor lag.
#define MARK_EXCESS 100

#endif

I downloaded it and included it Thank you!

But now it is not showing the buttons i press

I am in agreement with @johnwasser in that your installation of the IRremote library may not be complete. I would suggest you delete prior installations and use the IDE library manager to install the library. Using the library manager.

That code was written for an older version of the IRremote library (<3.0). If you install the latest version of the library the older code may not work right. The IRremote library GitHub page tells how to fix old code to work with the new library version.

Here is a basic IRremote library code to get the key codes and protocol from a remote control. Code was written for an Uno. Note the IR receiver is wired to pin 4.

#include <IRremote.hpp>

const byte IR_RECEIVE_PIN = 4;

unsigned long keycommand = 0;
unsigned long keyaddress = 0;
decode_type_t remoteprotocol;

bool newIR = false;

const char *thisProtocol[] = {"UNKNOWN", "PULSE_DISTANCE","PULSE_WIDTH","DENON","DISH","JVC","LG","LG2","NEC","PANASONIC",
                              "KASEIKYO","KASEIKYO_JVC","KASEIKYO_DENON","KASEIKYO_SHARP","KASEIKYO_MITSUBISHI","RC5","RC6",
                              "SAMSUNG","SHARP","SONY","ONKYO","APPLE","BOSEWAVE","LEGO_PF","MAGIQUEST","WHYNTER"};

void setup()
{
   Serial.begin(115200);
   Serial.println("IR receive test");
   IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
}

void loop()
{
   checkIR();

   if (newIR)
   {
      printIR();
      newIR = false;
   }
}

void checkIR()
{
   if (IrReceiver.decode())
   {
      keycommand = IrReceiver.decodedIRData.command;
      keyaddress = IrReceiver.decodedIRData.address;
      remoteprotocol = IrReceiver.decodedIRData.protocol;

      if ((IrReceiver.decodedIRData.flags & IRDATA_FLAGS_IS_REPEAT))
      {
         IrReceiver.resume();
         return;
      }

      IrReceiver.resume();
      newIR = true;
   }
}

void printIR()
{
   Serial.print("decoded command = ");
   Serial.print(keycommand, HEX);
   Serial.print("     decoded address = ");
   Serial.print(keyaddress, HEX);
   Serial.print("     decoded protocol = ");
   Serial.println(thisProtocol[remoteprotocol]);
   Serial.println();
}

You should always use the library manager to install libraries if possible. That way you can know that the installation is done properly. The IRremote library is available via the library manager.

I think my remote may be defective because it says IR Reciever button decode but after that there isnt anything after i push every single button

I am using the IR remote included with "The most complete starter kit uno r3 project" by elegoo and I am using the IR Reciever module include with that as well. I dont know what is happening.