Fix "'ESP_LOGCONFIG' was not declared in this scope" error#6
Open
ypid wants to merge 1 commit intoRoboMagus:mainfrom
Open
Fix "'ESP_LOGCONFIG' was not declared in this scope" error#6ypid wants to merge 1 commit intoRoboMagus:mainfrom
ypid wants to merge 1 commit intoRoboMagus:mainfrom
Conversation
It worked previously because the include order is not fixed I guess and
some other component always included `log.h` before git_ref.
```
In file included from src/esphome.h:10,
from src/main.cpp:3:
src/esphome/components/git_ref/git_ref_sensor.h: In member function 'virtual void esphome::git_ref::GitRefTextSensor::dump_con
fig()':
src/esphome/components/git_ref/git_ref_sensor.h:27:5: error: 'ESP_LOGCONFIG' was not declared in this scope
27 | ESP_LOGCONFIG(TAG, "GitRefTextSensor:");
| ^~~~~~~~~~~~~
src/esphome/components/git_ref/git_ref_sensor.h:27:5: note: the macro 'ESP_LOGCONFIG' had not yet been defined In file included from src/esphome/components/sensor/sensor.h:3,
from src/esphome/components/internal_temperature/internal_temperature.h:4,
from src/esphome.h:11:
src/esphome/core/log.h:155: note: it was later defined here
155 | #define ESP_LOGCONFIG(tag, ...) esph_log_config(tag, __VA_ARGS__)
|
```
```
$ head .esphome/build/my-sensor/src/esphome.h -n 20
#pragma once
#include "esphome/core/macros.h"
#include "esphome/components/binary_sensor/automation.h"
#include "esphome/components/binary_sensor/binary_sensor.h"
#include "esphome/components/binary_sensor/filter.h"
#include "esphome/components/button/automation.h"
#include "esphome/components/button/button.h"
#include "esphome/components/esp32/gpio.h"
#include "esphome/components/esp32/preferences.h"
#include "esphome/components/git_ref/git_ref_sensor.h"
#include "esphome/components/internal_temperature/internal_temperature.h"
#include "esphome/components/logger/logger.h"
```
200c862 to
dcdbb00
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It worked previously because the include order is not fixed I guess and some other component always included
log.hbefore git_ref.