Overriding a define

Hi!
I need to include in one of my project a library. This library contains a #define statement (without #ifdef) that i need to override. For now i've created my library with the corrected define, but i need to update it as soon as there is an update on the original library, seem far from optimal.
I've tried some combinations of #define/#undef placed in various placed, tried to create an .h with the corrected define, then including the original library, but nothing worked.
It's possible in some way to override that statement?
Thanks!

#ifdef
#undef
#define
#endif

Dont forget the Name in First three and also the value in third line. Also If I Recall correctly, First include lib.h than These defines, but this can be wrong.

Tried that, but not work. Maybe the thing is a bit more difficult, as the .h that have the define statement is not the one included in the code, but it's a .h included on it.

If you library is a .cpp, then it is compiled separately from your .ino file so you can not control how it is done, other than modify the .h file directly. Have you tried that? Have you tried submitting a defect against that library? (if it is one)

One solution is to re-name the library that you have modified. That way, updates to the library will not overwrite your modifications.

The define that i'm trying to override is in the official Ethernet library.
I include the ethernet.h, and i need to override the define in "utility/w5100.h"

#define SPI_ETHERNET_SETTINGS SPISettings(14000000, MSBFIRST, SPI_MODE0)

I need to set this one on a different value. I've already copied the library and renamed, but in this way if there is an update to the main library, i need to merge it.

masterx81:
The define that i'm trying to override is in the official Ethernet library.
I include the ethernet.h, and i need to override the define in "utility/w5100.h"

#define SPI_ETHERNET_SETTINGS SPISettings(14000000, MSBFIRST, SPI_MODE0)

I'm a little confused about why your W5100 chip needs different SPI settings.

I'm using it on a Industruino D21G hardware (w5500), that need 4000000bps setting. Industruino came with a modified ethernet2 library that miss a lot of functions present on the official library (for example the linkStatus). The official ethernet library works perfectly changing only that.

If you look at the utility/w5100.h file, there are a lot of tests for different architectures that adjust these SPI_SETTINGS. The best way would be to submit a patch to the official library for support of your board. I don't know anything about that so I can't comment on what ARDUINO_ARCH_XXXX would be in this case.