Undefined reference to `IRsend::begin(unsigned char)’

when i try to build it gives me this collect2.exe: error: ld returned 1 exit status
*** [.pio\build\featheresp32\firmware.elf] Error 1 but i dont have anything in the lib folder

Full error message and platformio.ini?

This is my platformio.ini

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:featheresp32]
platform = espressif32@6.2.0
board = featheresp32
framework = arduino
monitor_speed = 115200
lib_deps = 
	moononournation/GFX Library for Arduino@^1.3.2
	z3t0/IRremote@^4.1.2
	olikraus/U8g2@^2.34.17
	robtillaart/SHT2x @ ^0.3.0

monitor_filters = esp32_exception_decoder
build_flags = 
	'-Wl,"-zmuldefs"'
	'-w'

`and this is the full error:" collect2.exe: error: ld returned 1 exit status
*** [.pio\build\featheresp32\firmware.elf] Error 1"

There must be a line before that, which is the actual errorm essage. Post the entire output of the “Build” button to pastebin.com if needed.

Also I’m not sure why you would need to allow multiple definitions via the build_flags.

sorry im new to this so is this the error message : c:/users/ehfdy/.platformio/packages/toolchain-xtensa-esp32/bin/…/lib/gcc/xtensa-esp32-elf/8.4.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: .pio\build\featheresp32\src\main.cpp.o:(.literal._Z9irhandlerPv+0xc): undefined reference to IRsend::begin(unsigned char)' c:/users/ehfdy/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\featheresp32\src\main.cpp.o: in function irhandler(void*)‘:
C:\Users\ehfdy\Desktop\takt\tctb-master\tctb-master/src/main.cpp:49: undefined reference to `IRsend::begin(unsigned char)’
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\featheresp32\firmware.elf] Error 1

Delete the .pio folder of the project and compile again.

still the same problem the folder created again when i started the build

I can’t reproduce that problem at all. With your exact platformio.ini and a src/main.cpp of

#include <Arduino.h>
#include <Arduino_GFX.h>
#include <U8g2lib.h>
#include <SHT2x.h>
#include <IRremote.hpp>

void setup () {
    IrSender.begin(10);
}

void loop() {
    
}

the project compiles fine. The linker error indicates that the IRsend::begin() function lacks an implementation. But it’s there, the library is compiled.

Linking .pio\build\featheresp32\firmware.elf
Retrieving maximum program size .pio\build\featheresp32\firmware.elf
Checking size .pio\build\featheresp32\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   7.0% (used 23076 bytes from 327680 bytes)
Flash: [==        ]  18.6% (used 243285 bytes from 1310720 bytes)
Building .pio\build\featheresp32\firmware.bin
esptool.py v4.5.1
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.
============================= [SUCCESS] Took 89.57 seconds =============================

Can you please upload the project as a whole to e.g. Github or google drive?

its actually from here to be used to the tctb and i am trying to upload code to it Files · master · etalon etalon / tctb · GitLab

Okay, very interesting, that error is reproducible. Let me look into it.

Got it.

The problem is a breaking change within the IRremote library. With

	z3t0/IRremote@^4.1.2

specificed it would actually download a newer version (as is allowed by the ^ semver, so any 4.x.x version), but they have decided that if an IR_SEND_PIN pin is defined, then the function IRsend::begin(pin) should be not be compiled. They instead just expect IRsend.begin() without a pin.

However, that was working in IRremote version 4.1.2.

So, all we have to do is pin the version of the IRremote library to the exact one that was originally used. So, just change the platformio.ini to

[env:featheresp32]
platform = espressif32@6.2.0
board = featheresp32
framework = arduino
monitor_speed = 115200
lib_deps = 
	moononournation/GFX Library for Arduino@^1.3.2
	z3t0/IRremote@4.1.2
	olikraus/U8g2@^2.34.17
	robtillaart/SHT2x @ ^0.3.0

monitor_filters = esp32_exception_decoder
build_flags = 
	'-Wl,"-zmuldefs"'
	'-w'

and recompile.

oh my god thank you so much