help conflicting declaration of C
Posted: Tue Aug 11, 2020 1:46 pm
Hi everyone
building my C firmware as C++ I'm stumbling on these errors which come from a MACRO in esp_attr.h
building is successful if in esp_attr.h I comment the MACRO in question (FLAG_ATTR_IMPL)
and make it to do only
can anyone help me understand what is going on?
building my C firmware as C++ I'm stumbling on these errors which come from a MACRO in esp_attr.h
Code: Select all
~/esp-idf/components/xtensa/include/esp_attr.h:110:34: error: conflicting declaration of C function 'constexpr timer_intr_t operator~(timer_intr_t)'
~/esp-idf/components/xtensa/include/esp_attr.h:111:34: error: conflicting declaration of C function 'constexpr timer_intr_t operator|(timer_intr_t, timer_intr_t)'
~/esp-idf/components/xtensa/include/esp_attr.h:112:34: error: conflicting declaration of C function 'constexpr timer_intr_t operator&(timer_intr_t, timer_intr_t)'
~/esp-idf/components/xtensa/include/esp_attr.h:113:34: error: conflicting declaration of C function 'constexpr timer_intr_t operator^(timer_intr_t, timer_intr_t)'
~/esp-idf/components/xtensa/include/esp_attr.h:114:34: error: conflicting declaration of C function 'constexpr timer_intr_t operator>>(timer_intr_t, int)'
~/esp-idf/components/xtensa/include/esp_attr.h:115:34: error: conflicting declaration of C function 'constexpr timer_intr_t operator<<(timer_intr_t, int)'
~/esp-idf/components/xtensa/include/esp_attr.h:116:25: error: conflicting declaration of C function 'timer_intr_t& operator|=(timer_intr_t&, timer_intr_t)'
~/esp-idf/components/xtensa/include/esp_attr.h:117:25: error: conflicting declaration of C function 'timer_intr_t& operator&=(timer_intr_t&, timer_intr_t)'
~/esp-idf/components/xtensa/include/esp_attr.h:118:25: error: conflicting declaration of C function 'timer_intr_t& operator^=(timer_intr_t&, timer_intr_t)'
~/esp-idf/components/xtensa/include/esp_attr.h:119:25: error: conflicting declaration of C function 'timer_intr_t& operator>>=(timer_intr_t&, int)'
~/esp-idf/components/xtensa/include/esp_attr.h:120:25: error: conflicting declaration of C function 'timer_intr_t& operator<<=(timer_intr_t&, int)'
Code: Select all
#ifdef __cplusplus
// Inline is required here to avoid multiple definition error in linker
#define FLAG_ATTR_IMPL(TYPE, INT_TYPE) \
FORCE_INLINE_ATTR constexpr TYPE operator~ (TYPE a) { return (TYPE)~(INT_TYPE)a; } \
FORCE_INLINE_ATTR constexpr TYPE operator| (TYPE a, TYPE b) { return (TYPE)((INT_TYPE)a | (INT_TYPE)b); } \
...
#else
...
#endif
Code: Select all
#define FLAG_ATTR(TYPE)