Page 1 of 1

Eclipse generating 'Invalid Args' for ESP_LOG() macros

Posted: Tue Feb 05, 2019 12:27 am
by william.ferguson.au
The code compiles OK, but the Eclipse edit window has every ESP_LOGI() statement underlined in red, saying that it has invalid arguments.

Eg
static const char* TAG = "wt_comms";

ESP_LOGI(TAG, "Reconnecting to WiFi");


Image

When you hover over it, the popup gives:
"Invalid arguments '
Candidates are:
void esp_log_write(enum {/wt_starter_esp_idf/components/arduino-esp32/tools/sdk/include/log/esp_log.h:822}, const char *, const char *, ...)
'"


All my includes appear to be OK. Everything else gets reported correctly.
It's just the ESP_LOG macros.

What am I missing?

Re: Eclipse generating 'Invalid Args' for ESP_LOG() macros

Posted: Tue Feb 05, 2019 2:25 am
by ESP_Angus
If you use F3 to "go to" the source file represented by the "#include esp_log.h" line, does it go to the correct source file? Are that header file's recursive includes properly referenced?

Re: Eclipse generating 'Invalid Args' for ESP_LOG() macros

Posted: Tue Feb 05, 2019 5:00 am
by william.ferguson.au
Yes, it goes to esp-idf/components/log/include/esp_log.h
Are that header file's recursive includes properly referenced?
I think so. When I look at the includes they are not marked as being incorrect.

esp_log.h is found twice in my include path.
Once in esp-idf and once in arduino-esp32.
Is that likely the problem?

William

Re: Eclipse generating 'Invalid Args' for ESP_LOG() macros

Posted: Tue Feb 05, 2019 10:46 pm
by ESP_igrr
Once in esp-idf and once in arduino-esp32.
Is that likely the problem?
It might be because esp_log_level_t is an anonymous enum, and Eclipse builds an identifier for it out of file path:

enum {/wt_starter_esp_idf/components/arduino-esp32/tools/sdk/include/log/esp_log.h:822}

Hypothetically, changing enum declaration from

typedef enum { } esp_log_level_t;

to

typedef enum esp_log_level_t { } esp_log_level_t;

in both header files should fix the issue.

Re: Eclipse generating 'Invalid Args' for ESP_LOG() macros

Posted: Tue Feb 05, 2019 11:17 pm
by william.ferguson.au
Thank you !!! That worked.

It now let's me see the other warnings that Eclipse has brought up.
All of them because of duplicate includes from components/arduino-esp32/tools/sdk/include

What is the standard way of ensuring that components/arduino-esp32/tools/sdk/include isn't picked up?

Re: Eclipse generating 'Invalid Args' for ESP_LOG() macros

Posted: Tue Feb 05, 2019 11:47 pm
by william.ferguson.au
I have also raised this as an issue at arduino-esp32 https://github.com/espressif/arduino-esp32/issues/2426
As I suspect it needs to be fixed in the arduino-esp32/component.mk