Is it possible to have a #defined directive in your sketch and be used by your included library?
(i 've even tried using #define extern VAR, but nothing... i might also use it in a wrong way .. )
Something like this for example:
LIBRARY.cpp
//code
...
#if (x == 1)
//compile here 1 - code
#else
//compile here 0 - code
#endif
...
Is it possible to have a #defined directive in your sketch and be used by your included library?
The sketch is compiled. The library is compiled. Those are two separate steps. If the #define statement is not accessible to both compilation steps, then one of them will not produce the result that you expect.
You generally get around this by putting #define statements to be shared in a header file and #including it in both the sketch and the library.
In your example, the #define statement in the sketch will not be visible when the library is compiled.
That only works because all the code affected by that macro is in the header file. It would not work if that code was in the .cpp file of the library, which is a separate translation unit from the sketch.
pert:
You can see another approach demonstrated by how the Encoder library is able to be configured from the sketch by defining the ENCODER_DO_NOT_USE_INTERRUPTS macro before the #include directive for the library ...