vortigont / MuiPlusPlus

On-Screen Menu and UI controls library for 32 bit MCUs
GNU Lesser General Public License v2.1
2 stars 0 forks source link

Does not compile on standard ESP32 Arduino-Core project with PlatformIO #3

Closed PhilippMolitor closed 1 week ago

PhilippMolitor commented 2 weeks ago

Currently, this library does not compile under the standard ESP32 Arduino Core with PlatformIO.

Here is the build output log:

In file included from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:6,
                 from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.cpp:1:
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp:11:8: error: 'string_view' in namespace 'std' does not name a type
   std::string_view _lookup;
        ^~~~~~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp:11:3: note: 'std::string_view' is only available from C++17 onwards
   std::string_view _lookup;
   ^~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp: In constructor 'muipp::MatchLabel<T>::MatchLabel(const char*)':
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp:13:44: error: class 'muipp::MatchLabel<T>' does not have any field named '_lookup'
   explicit MatchLabel(const char* label) : _lookup(label) {}
                                            ^~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp: In member function 'bool muipp::MatchLabel<T>::operator()(const T&)':
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp:16:14: error: '_lookup' was not declared in this scope
       return _lookup.compare(item.getName()) == 0;
              ^~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp:16:14: note: suggested alternative: '_lock_t'
       return _lookup.compare(item.getName()) == 0;
              ^~~~~~~
              _lock_t
Compiling .pio/build/devboard-s3-n16r8v-debug/liba97/TMCStepper/source/PWMCONF.cpp.o
Compiling .pio/build/devboard-s3-n16r8v-debug/liba97/TMCStepper/source/RAMP_STAT.cpp.o
In file included from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.cpp:1:
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp: In constructor 'MuiItem_Uncontrollable::MuiItem_Uncontrollable(muiItemId, const char*)':
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:171:101: error: no matching function for call to 'MuiItem::MuiItem(muiItemId&, const char*&, <brace-enclosed initializer list>)'
   MuiItem_Uncontrollable(muiItemId id, const char* name = nullptr) : MuiItem(id, name, {false, true}){}
                                                                                                     ^
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:129:3: note: candidate: 'MuiItem::MuiItem(muiItemId, const char*, item_opts)'
   MuiItem(muiItemId id, const char* name = nullptr, item_opts options = item_opts()) : id(id), name(name), opt(options) {};
   ^~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:129:3: note:   no known conversion for argument 3 from '<brace-enclosed initializer list>' to 'item_opts'
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:99:7: note: candidate: 'constexpr MuiItem::MuiItem(const MuiItem&)'
 class MuiItem {
       ^~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:99:7: note:   candidate expects 1 argument, 3 provided
Compiling .pio/build/devboard-s3-n16r8v-debug/liba97/TMCStepper/source/SERIAL_SWITCH.cpp.o
Compiling .pio/build/devboard-s3-n16r8v-debug/liba97/TMCStepper/source/SGCSCONF.cpp.o
*** [.pio/build/devboard-s3-n16r8v-debug/lib295/MuiPlusPlus/muiplusplus.cpp.o] Error 1
In file included from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:6,
                 from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.hpp:3,
                 from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.cpp:1:
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp:11:8: error: 'string_view' in namespace 'std' does not name a type
   std::string_view _lookup;
        ^~~~~~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp:11:3: note: 'std::string_view' is only available from C++17 onwards
   std::string_view _lookup;
   ^~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp: In constructor 'muipp::MatchLabel<T>::MatchLabel(const char*)':
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp:13:44: error: class 'muipp::MatchLabel<T>' does not have any field named '_lookup'
   explicit MatchLabel(const char* label) : _lookup(label) {}
                                            ^~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp: In member function 'bool muipp::MatchLabel<T>::operator()(const T&)':
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp:16:14: error: '_lookup' was not declared in this scope
       return _lookup.compare(item.getName()) == 0;
              ^~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_tpl.hpp:16:14: note: suggested alternative: 'loop'
       return _lookup.compare(item.getName()) == 0;
              ^~~~~~~
              loop
In file included from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.hpp:3,
                 from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.cpp:1:
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp: In constructor 'MuiItem_Uncontrollable::MuiItem_Uncontrollable(muiItemId, const char*)':
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:171:101: error: no matching function for call to 'MuiItem::MuiItem(muiItemId&, const char*&, <brace-enclosed initializer list>)'
   MuiItem_Uncontrollable(muiItemId id, const char* name = nullptr) : MuiItem(id, name, {false, true}){}
                                                                                                     ^
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:129:3: note: candidate: 'MuiItem::MuiItem(muiItemId, const char*, item_opts)'
   MuiItem(muiItemId id, const char* name = nullptr, item_opts options = item_opts()) : id(id), name(name), opt(options) {};
   ^~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:129:3: note:   no known conversion for argument 3 from '<brace-enclosed initializer list>' to 'item_opts'
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:99:7: note: candidate: 'constexpr MuiItem::MuiItem(const MuiItem&)'
 class MuiItem {
       ^~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:99:7: note:   candidate expects 1 argument, 3 provided
In file included from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.cpp:1:
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.hpp: In constructor 'MuiItem_U8g2_ActionButton::MuiItem_U8g2_ActionButton(U8G2&, muiItemId, mui_event, const char*, const uint8_t*, u8g2_uint_t, u8g2_uint_t, text_align_t, text_align_t)':
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.hpp:169:57: error: no matching function for call to 'MuiItem::MuiItem(muiItemId&, const char*&, <brace-enclosed initializer list>)'
       MuiItem(id, lbl, {false, false}), _action(onAction) {};
                                                         ^
In file included from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.hpp:3,
                 from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.cpp:1:
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:129:3: note: candidate: 'MuiItem::MuiItem(muiItemId, const char*, item_opts)'
   MuiItem(muiItemId id, const char* name = nullptr, item_opts options = item_opts()) : id(id), name(name), opt(options) {};
   ^~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:129:3: note:   no known conversion for argument 3 from '<brace-enclosed initializer list>' to 'item_opts'
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:99:7: note: candidate: 'constexpr MuiItem::MuiItem(const MuiItem&)'
 class MuiItem {
       ^~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:99:7: note:   candidate expects 1 argument, 3 provided
In file included from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.cpp:1:
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.hpp: In constructor 'MuiItem_U8g2_CheckBox::MuiItem_U8g2_CheckBox(U8G2&, muiItemId, const char*, bool, index_cb_t, const uint8_t*, u8g2_uint_t, u8g2_uint_t)':
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.hpp:281:70: error: no matching function for call to 'MuiItem::MuiItem(muiItemId&, const char*&, <brace-enclosed initializer list>)'
       MuiItem(id, label, {false, false}),_v(value), _action(action_cb){}
                                                                      ^
In file included from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.hpp:3,
                 from .pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muipp_u8g2.cpp:1:
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:129:3: note: candidate: 'MuiItem::MuiItem(muiItemId, const char*, item_opts)'
   MuiItem(muiItemId id, const char* name = nullptr, item_opts options = item_opts()) : id(id), name(name), opt(options) {};
   ^~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:129:3: note:   no known conversion for argument 3 from '<brace-enclosed initializer list>' to 'item_opts'
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:99:7: note: candidate: 'constexpr MuiItem::MuiItem(const MuiItem&)'
 class MuiItem {
       ^~~~~~~
.pio/libdeps/devboard-s3-n16r8v-debug/MuiPlusPlus/src/muiplusplus.hpp:99:7: note:   candidate expects 1 argument, 3 provided
*** [.pio/build/devboard-s3-n16r8v-debug/lib295/MuiPlusPlus/muipp_u8g2.cpp.o] Error 1

I've seen this setting on the ESPIron-PTS200 firmware:

build_unflags =
    -std=gnu++11
build_flags =
    -std=gnu++17

Maybe this is relevant for it to work? It should be adjusted to compile with C++11 IMO.

PhilippMolitor commented 2 weeks ago

I just tested the switch to gnu++17, this made it work. Still not very good for easy setup, the need for the change I lined out at the bottom should be in the readme.

vortigont commented 2 weeks ago

Hi! Yes, it needs cpp17. It is mentioned in readme actually: MuiPlusPlus is heavily using STL, C++17 (needs std::string_view, std::ostringstream) I'll add needed build flags there also.

Core lib does not need it, C++11 is OK, but for mui elements I used it to simplify text strings processing. I'd better stick to STL then to Arduino Strings 'cause I have intention to use is under ESP-IDF without Arduino core. IDF 5.x is using cpp21 if I'm not mistaken, so this change is needed for older core. Platformio is still using IDF 4 with c11 by default.