Page 1 of 1

help conflicting declaration of C

Posted: Tue Aug 11, 2020 1:46 pm
by SO_yeah
Hi everyone
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)'
building is successful if in esp_attr.h I comment the MACRO in question (FLAG_ATTR_IMPL)

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
and make it to do only

Code: Select all

#define FLAG_ATTR(TYPE)
can anyone help me understand what is going on?

Re: help conflicting declaration of C

Posted: Mon Jan 03, 2022 11:08 pm
by alx_alx
Hello, I am getting the same error, did you figure out why you need to comment out the MACRO ?