Trying to install IRemoteESP8266, getting 155 errors

Hi,
I been using arduino for almost 5 days now. I am used to vscode so I’d like to use for arduino development. PlatformIO looks really great so far.
For my task I need to use IRemote library, so found one in libraries and installed it. I got confirmation about successful installation.
I copy these two line from example in the library:
#include <IRremoteESP8266.h>
#include <IRsend.h>

then I try to build, and it fails with 155 errors.
I could only find old threads with similar problems but nothing exactly the same.

Is there any solution to this problem?

In the bottom blue taskbar there is the project environment switcher, currently set to “Default”. Switch it to the “megaatmega2560” envirnment first.

Since compilation doesn’t seem to work, also show your full platformio.ini.

Hold up one second, this makes no sense. The library that you have in your workspace is called IRemoteESP8266 (GitHub - crankyoldgit/IRremoteESP8266: Infrared remote library for ESP8266/ESP32: send and receive infrared signals with multiple protocols. Based on: https://github.com/shirriff/Arduino-IRremote/) for an ESP8266. You’re compiling for an Mega 2560. Are you sure you don’t want to use https://platformio.org/lib/show/4/IRremote?

; 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
; Redirecting...
[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
lib_deps = crankyoldgit/IRremoteESP8266@^2.7.20

are you saying that library I have installed is incompatible with mega2560?

Yes, an ESP8266 is not an ATMega2560. Entirely different architecture and chip. The library declares the compatibility as

Replace this line with

lib_deps = z3t0/IRremote @ ^3.4.0

Then instead of your current main.cpp use the code found in Arduino-IRremote/examples/SimpleReceiver at master · Arduino-IRremote/Arduino-IRremote · GitHub. There are two files.

ok, so I have installed the library you mention and it looks to be able to build at least with that one extra line:
#include <IRremoteInt.h>

although intellisense complains. I gues as long as it builds I can ignore intellisense or there is a solution to tune intellisense?

another question is how can I check library compatibility? I could not see mega2560 anywhere in that library description.

That’s for internal functions – it should only be required to use #include <IRremote.hpp> (or .h, it redirects to .hpp.

Ctrl+Shift+P → Rebuild IntelliSense.

Every library shows you its compatible platforms. On IRremote (https://platformio.org/lib/show/4/IRremote)

grafik

On https://platformio.org/lib/show/1089/IRremoteESP8266

grafik

Since an Mega 2560 has an ATMega2560 chip on it, which PlatformIO counts in the Atmel AVR family (notice the platform = atmelavr line in the platformio.ini). Which is only listed in the IRremote lib.

1 Like