Skip to content

Compiling via arduino IDE for ESP32-C3 (using g++) : error because of designated initalizers #178

@sfosset

Description

@sfosset

To day I tried compiling a sketch using electricui-embedded 0.8.0 (installed via Arduino IDE).
The target is Seeduino XIAO ESP32.
The IDE tries to compile with this line (using g++) :

AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp-rv32\\2302/bin/riscv32-esp-elf-g++" -MMD -c

I get the following error when using the macros for setting up the tracked variables

libraries\electricui-embedded\src/eui_macro.h:49:105: error: either all initializer clauses should be designated or none of them should be
49 | #define EUI_CUSTOM_RO( ID, DATA ) { .id = ID, .type = TYPE_CUSTOM|READ_ONLY_MASK, .size = sizeof(DATA), {.data = &DATA} }

The error is pretty self-explanatory : I manually added the .ptr= name in front of all {.data = &DATA} in eui_macro.h, and it compiled successfully.
Maybe you can consider adding this change to the next release to have more compatibility with C++ compilers ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions