5

In Arduino Eclipse (v3, nightly build) I have not been able to load 'foreign' libraries, those written by me or someone else, so they are not among the available choices in the include-library dialogs.

I've tried adding them to a project as well as adding them as an available library resource using the built-in dialogs for doing so, but I don't see a way to select a library that isn't already included in those dialogs.

My ideal case would be a way for the Arduino Eclipse plugin to use the same boards and libraries as I use in my Arduino IDE installation, so that:

  • An upgrade to the Arduino IDE would simultaneously upgrade the core libraries in Eclipse;
  • An optional library would need installing in only one place;
  • Modifying an optional library would only need to be done once, in one place.

The goal, as in an earlier question of mine, is to seamlessly permit using either IDE to advance a project. However, I'd be grateful to be able to add to my Eclipse installation any library of my choosing.

2 Answers 2

2

I fear that what you want is not 100% possible.
For libraries I am 100% sure it will work but the problem is the platforms.
UPDATE arduino IDE (no longer)? decompresses libraries and as such the libraries are unusable in Sloeber.

Lets start with the Libraries What you do is: In arduino eclipse ide remove all libraries from the library manager.

In windows->preferences->arduino->"private libraries path" add the libraries folder in the arduino IDE install and add the libraries folder in the arduino15 folder maintained by the library manager.
It is important to point to the parent folder containing the libraries. All subfolders are assumed to be libraries.

Then the boards The problem here is that the boardsmanager adds environment variables to link boards to tools. You may have read remarks about A.RUNTIME.TOOLS.AVR-GCC.PATH and A.RUNTIME.TOOLS.AVRDUDE.PATH not being defined. Well it is the boardsmanager that maintains these based on json file content. If you can limit yourself to 1 version of AVR, SAM, AVRDUDE, BSON,... tool chain you can "make it work" as follows:
Step 1: Keep as little boards as possible installed. You have to keep at least 1 or the plugin will reinstall the AVR boards of Arduino when started.
Step 2: In windows->preferences->arduino->"private hardware path" add the hardware folder in the arduino IDE install and add the packages folder in the arduino15 folder maintained by the Arduino IDE boards manager.
Step 3: Recreate the project in eclipse as described in your other question.
Step 4: If the build fails modify the [eclipse installation]/arduinoPlugin/post and pre processing files to try to get it to work.
Step 5: in project properties->Arduino select apply and OK (this will take your changes in step 4 into account)
Step 6: Goto Step 4

Good luck Jantje

5
  • This works - except for one library set (Blynk) - but I was surprised that #include <someLibrary.h> was not sufficient; that the library had to be imported as well. In the Blynk librarycase, their example program compiles in the Arduino IDE but Eclipse complains that it can't find a Blynk.begin() with a signature matching the call from the example program.
    – JRobert
    Mar 26, 2016 at 16:42
  • About the boards: Does that mean I can't compile the same code for either an Uno or a Mega2560 at will? Or I can, but not if I upgrade the Arduino IDE (currently v1.6.7 with eclipse plugin 'mac64.2016-03-23_03-43-04')?
    – JRobert
    Mar 26, 2016 at 16:49
  • The way Arduino IDE finds libraries is different from the Arduino eclipse ide. This may explain why Blynk was not found and needed to be imported. The Arduino IDE searches the content of the library folders for (header)files matching your include. The Arduino eclipse plugin finds libraries based on foldername=include -".h"
    – jantje
    Mar 26, 2016 at 17:20
  • I do not understand your board question.
    – jantje
    Mar 26, 2016 at 17:21
  • .h files: Are you saying quoted .h file names will be found automatically but bracketed ones won't? -- Boards: You wrote "For libraries I am 100% sure it will work but the problem is the platforms." and described some limitations due to the board manager. I didn't understand what the consequences are or when they might happen.
    – JRobert
    Mar 26, 2016 at 17:33
1

Making Blynk libraries, v0.3.6 and (presumably) later, Eclipse compatible.

With much help from Jantje (thank you!), I found 4 easy steps that make the Blynk v0.3.6 libraries Eclipse-compatible:

  1. Create .../libraries/Blynk/Blynk.h (may be empty) 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 (unless you're running Linux! In which case, some more discovery needs doing.)
  4. In Blynk projects previously imported to Eclipse Arduino, delete the (possibly hidden) file .ino.cpp 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 was resulting in multiple definition errors at link time.

The above is an excerpt from a how-to I posted to the Blynk community but I think this has all of the relevant information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.