help conflicting declaration of C

SO_yeah
Posts: 4
Joined: Wed Mar 16, 2016 5:34 pm

help conflicting declaration of C

Postby SO_yeah » 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

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?

alx_alx
Posts: 2
Joined: Mon Nov 02, 2020 2:57 am

Re: help conflicting declaration of C

Postby alx_alx » Mon Jan 03, 2022 11:08 pm

Hello, I am getting the same error, did you figure out why you need to comment out the MACRO ?

Who is online

Users browsing this forum: No registered users and 304 guests