#ifdef not working
Posted: Tue Dec 05, 2023 5:17 pm
Hi all
In Arduino IDE i have this at my main code:
and this on my todayLib.c library file:
If i run this code i see "Now is not Today", so it seems my #define TODAY is not being recognized inside my library.
If i move the #define TODAY into todayLib.h, it works as expected.
Is this a normal behavior?
I want to adapt my library to work with two different boards, so how do i define something on my main code that runs different parts of my library?
In Arduino IDE i have this at my main code:
Code: Select all
#define TODAY
#include "todayLib.h"
Code: Select all
#ifdef TODAY
Serial.print("Now is Today");
#else
Serial.print("Now is not Today");
#endif
If i move the #define TODAY into todayLib.h, it works as expected.
Is this a normal behavior?
I want to adapt my library to work with two different boards, so how do i define something on my main code that runs different parts of my library?