Closed mattbaker-digital closed 5 months ago
Would it not be better to have a cpp file with this stuff in instead of just headers?
I see this is a duplicate. However, based on how many times this has been raised before, I do wonder if there is a better way?
https://github.com/arkhipenko/TaskScheduler/issues?q=is%3Aissue+is%3Aclosed++multiple+definition
There is a better way, but it requires total redesign of the library.
There are a number of compile options driven by #define
statements
Arduino IDE ignores defines unless the entire library is in one header file.
If I move back to h/cpp I will lose compile options. Given the workaround it is not that bad/critical to sacrifice backward-compatibility.
@arkhipenko thanks for the explanation. I was unaware of the Arduino IDE limitation.
For example:
main.cpp
foo.cpp
Causes the following error when compiled using PlatformIO:
The same applies if using
TScheduler.hpp
Based on some quick testing, I believe this is due to not inlining the methods inside
TaskScheduler.h
and trying to rely on the inlines inTaskSchedulerDeclarations.h
instead.