diff --git a/esphome/components/runtime_stats/runtime_stats.cpp b/esphome/components/runtime_stats/runtime_stats.cpp index 75c59e77ba..96a222da84 100644 --- a/esphome/components/runtime_stats/runtime_stats.cpp +++ b/esphome/components/runtime_stats/runtime_stats.cpp @@ -1,5 +1,4 @@ #include "runtime_stats.h" -#include "esphome/core/defines.h" #ifdef USE_RUNTIME_STATS @@ -10,6 +9,9 @@ namespace esphome { namespace runtime_stats { +// Forward declaration to help compiler +class RuntimeStatsCollector; + RuntimeStatsCollector::RuntimeStatsCollector() : log_interval_(60000), next_log_time_(0) { global_runtime_stats = this; } diff --git a/esphome/components/runtime_stats/runtime_stats.h b/esphome/components/runtime_stats/runtime_stats.h index 24dae46b2e..de241e439c 100644 --- a/esphome/components/runtime_stats/runtime_stats.h +++ b/esphome/components/runtime_stats/runtime_stats.h @@ -1,5 +1,7 @@ #pragma once +#include "esphome/core/defines.h" + #ifdef USE_RUNTIME_STATS #include @@ -122,4 +124,4 @@ extern runtime_stats::RuntimeStatsCollector } // namespace esphome -#endif // USE_RUNTIME_STATS \ No newline at end of file +#endif // USE_RUNTIME_STATS