Making Blynk libraries Eclipse-compatible

I can compile Blynk sketches in the Arduino IDE which will not compile with arduinoEclipse (Jantje’s Eclipse plugin). All my non-blynk sketches will compile with either one.

Blynk’s library structure does not match that of the ArduinoIDE - that the library modules for a <device> – <device>.cpp and <device>.h – are found in …/libraries/<device>. (Granted, this is a less than complete description).

The Arduino IDE finds all of the Blynk modules but eclipseArduino doesn’t. I know this sounds backward, but when I renamed f/ex the files in
.../libraries/BlynkESP8266_SoftSer/ESP8266.*
to:
.../libraries/BlynkESP8266_SoftSer/BlynkESP8266.*
Eclipse then finds those files. Unfortunately that doesn’t work for the many files contained in
.../libraries/Blynk/

Having to drop back to the ArduinoIDE for Blynk sketches is really inconvenient in an Eclipse (or other “real”) development environment.

With much help from Jantje, the author of the Eclipse Arduino plugin, I’ve been able to tweak the Blynk Arduino library to compile Blynk programs under both the Arduino IDE and Eclipse Arduino. Jantje wrote:

"For the first solution the question is: “Can I convince the author of the library to add a (empty is ok) Blynk.h file? And more importantly: Is the Author willing to add #include “Blynk.h” to all the examples.
This has no negative impact on the hex file, The working of Arduino IDE (should be more reliable) and it makes the plugin capable of doing auto Include of the library.
It is less than 5 minutes work, but it is the author of the lib his call.”

From this, I found I needed to take 4 steps to make Blynk 0.3.6 Eclipse-compatible:

  1. Create “.../libraries/Blynk/Blynk.h” and #include it before including any Blynk libraries.
  2. Likewise create and include “.../libraries/BlynkESP8266_Lib/BlynkESP8266_Lib.h
  3. Delete the entire folder “.../libraries/Blynk/linux
  4. In those Blynk projects I had already imported to Eclipse Arduino and tried to compile, delete the .ino.cpp hidden file and do a clean build.

This recipe works for me under MacOS 10.11.5, the Eclipse Arduino IDE nightly build, and ArduinoIDE version 1.6.9. It should be reproducible by anyone wishing to compile Blynk programs in Eclipse. Under OSes other than Mac, especially linux, step 3 may need to be modified. I deleted the linux folder to prevent Eclipse from compiling main.cpp and BlynkDebug.cpp from there which resulted in multiple definition errors at link time.

Alternatively, if the developers are willing to make this small change to the library configuration, it should make the libraries Eclipse compatible for everyone - with possible tweaks for OS-dependence as I noted above.

Many thanks to Jantje for his suggestion - I had tried everything else I could think of to make it work.

1 Like

Thanks. Created an issue, but can’t do any estimations for now!

Thank you! Not so urgent; it’s only a couple of steps for a user to do it until then.
I forgot to say explicitly (if it wasn’t clear from my previous post): the key to making library folders recognizable by Eclipse Arduino plugin seems to be that each library folder <Libe> needs to contain a file <Libe.h> (it may be empty), and the application source code needs to be #include “Libe.h” ahead of other files from that folder.

Is there anything being done with this? I’m now unable to compile any Blynk/ESP8266 projects (and maybe others but that’s my focus at the moment) with Eclipse. I continually get compiler errors of the nature of “BlynkXXX.h: No such file or directory”. The latest one is BlynkApiLinux.h. I can confirm it exists, but apparently Eclipse can not. This is making any serious software development for Blynk-aware projects more difficult than it needs to be, as I have to use a standalone text editor and the Arduino IDE to compile anything successful. The Arduino IDE is fine to get started with; for serious software development, it is seriously lacking. I don’t have this problem with non-Blynk projects in Eclipse.

Could we make the Blynk libraries be compatible with both IDEs? The manual interventions I described above work, but need to be re-applied (correctly! )-: each time we update to a new library version.