customized Ethernet library side-by-side with the standard one.


I have a customized Ethernet Library (i.e modifications in Arduino\libraries\Ethernet\src).
The problem is that everytime I'll make an update of the Arduino IDE the Ethernet library will be overwritten as well.
Is there a wise way to have a customized library side-by-side with the standard, updatable, library of Arduino?
I only want to access the customized library from my sketch.
Thank you.

You’re supposed to put your customized libraries in the libraries folder inside your sketchbook folder. That way they won’t be lost when you update the IDE.

ok. But this way I have some conflicts. :confused:
I select in Arduino IDE "Sketch-Include Library-MyEthernet".
Some #includes are automatically added in the sketch. Then I compile.

Here is compiler pseudo-output:

Multiple libraries were found for "Dhcp.h"
Used: ....\Arduino\libraries\MyEthernet
Not used: ....\Program Files (x86)\Arduino\libraries\Ethernet
Using library MyEthernet at version 1.0.0 in folder: ....\Arduino\libraries\MyEthernet

That looks like the correct Dhcp.h was chosen to me, what's the problem?

Sometimes it is good to simply get confirmation that you're on the right way.
Thank you pert.

You’re welcome. I don’t know if you’ve modified the filename of Ethernet.h in your library but note that if you haven’t and you do:

#include <Ethernet.h>

instead of

#include <Dhcp.h>

The message changes to:

Multiple libraries were found for "Ethernet.h"
 Used: C:\Program Files (x86)\arduino-1.6.8\libraries\Ethernet
 Not used: E:\sketchbook\libraries\MyEthernet

In this case the file from the standard library was included instead of the one in MyEthernet. The reason for this is that header filenames that match the library folder name take priority so because you have changed your folder name to MyEthernet your Ethernet.h file is not chosen over …\Program Files (x86)\Arduino\libraries\Ethernet/src/Ethernet.h. The easiest way to make a customized version of a standard library is to use the same folder name as the standard library but save the customized library to {sketchbook folder}\libraries, then you know it will always override the standard one and you don’t have to modify the includes in any example sketches.