[SOLVED] IRremote library compile Error

Moderators, if this is in the wrong forum, feel free to move it, Thanks.

I’m using this library here, and while old, compiles fine for the photon on Particle Build (online)

Things get strange when I compile the code in Particle Dev though:

// Library
  #include "IRremote.h"
  IRsend irsend(A5);
// Setup
  void setup() {
// Loop
  void loop() {

results in a cryptic compile error whose full text is cut off at the bottom status bar:
“build didn’t produce binary Error: Command failed: …/…/…/ …” clicking shows “There are no compile errors”.
However, using atom’s “developer tools” to view source of the IDE, I extracted the full text:

build didn't produce binary Error: Command failed: ../../../build/target/user/platform-6-m/4d5c9cbc6fbb22e9b2ef4aba8a74a5fb674888c75789e84783007064a667//libuser.a(IRremote.o): In function `__static_initialization_and_destruction_0':
IRremote.cpp:3: undefined reference to `IRsend::IRsend(int)'
collect2: error: ld returned 1 exit status
make: *** [/spark/compile_service/shared/workspace/6_platform_6_24_2/firmware/4d5c9cbc6fbb22e9b2ef4aba8a74a5fb674888c75789e84783007064a667/4d5c9cbc6fbb22e9b2ef4aba8a74a5fb674888c75789e84783007064a667.elf] Error 1

I haven’t edited the .h and .cpp files at all and they are sitting in the directory of the .ino file, as this is the way to do it in Particle Dev (the offline IDE).

I submitted an issue to github, but seeing as its 2 years old and that it’s working in particle build, I don’t know how much he can help (if he’s still around)

Can anyone experienced help me with this issue? Thanks a lot.

Can you submit a screenshot of your full Dev window?
There are some “quirks” in the usage of Dev independent of your code and target device.
e.g. make sure to have no other files in the project folder than your immediate source files.

You can also try particle compile photon . firmware.bin (from within the project folder) to get better error messages.

I’m not sure why it’s not building for you in Particle Dev. I downloaded the IRremote.cpp and IRremote.h files from github and used your code pasted above and it built successfully for me. Thanks for finding the library, however; that could come in handy some day!

I’m going to give the command line tool a try now
Thanks everyone for their replies ! It is probably something to do with my configuration I hope

C:\Programs\Temp>particle compile photon . firmware.bin

Compiling code for photon

attempting to compile firmware
pushing file: C:/Programs/Temp/IRremote.h
pushing file: C:/Programs/Temp/IRremote.ino
pushing file: C:/Programs/Temp/IRremote.cpp
Compile failed. Exiting.
../../../build/target/user/platform-6/libuser.a(IRremote.o): In function `__static_initialization_and_destruction_0':
IRremote.cpp:3: undefined reference to `IRsend::IRsend(int)'
collect2: error: ld returned 1 exit status
make: *** [407c93a422bf6ce3da94f69c1dd0380c550d53bc336ce3ece296d588500c.elf] Error 1


Hmm… Flashing other sketches still work, it is just this one that fails to build. I’ve tried: pietteTech_dht, adafruit_dht, IRTransmitter, they all work fine. its just this library for me… but it is crucial :frowning:

Just a guess here, but try renaming IRremote.ino to another name, like IRtest.ino.

Wow. that did it. Silly me, simple error on my part! Thanks a lot @rickkas7! And @ScruffR of course :smile:



Background on this:
.ino is just a “container” for not quite C++ code which will be fixed by the preprocessor to be “proper” C++ and will become a .cpp with the prefix of the original .ino after the treatment, so you actually had one .cpp overwriting the other.

1 Like