Open redstonee opened 6 months ago
Hi! I guess clang is less restrictive there as I doesn't complain. The Switch class is a specialization of the Widget class. Try to add ´template<>´ in front of the offending lines and see what happens. If that doesn't fix it I'll see to write it by the standards, but that might take some time.
Thanks very much for your reply!
I tried to rewrite the Switch
class with a more complicated way as below:
class Switch : public Widget<lv_switch_create> {
void initialize();
void initialize(Object &parent);
public:
using Widget::Widget;
};
And removed the constructors in switch.cpp
then it works.
Besides, there are some dynamic_pointer_cast
in anim.cpp, which requires RTTI feature. However if -fno-rtti
is removed when building the project for ESP32, linking errors occured. Then I replaced them with static_pointer_cast
, which made it able to build. But when an animation is configured, my ESP32 crashed with this info:
assert failed: void lvgl::misc::Animation::set_path_cb(lv_anim_path_cb_t) anim.cpp:60 (this != this->raw_ptr()->var)
Now I have no idea how to fix it. :(
Well, you're just subclassing a template class, which is fine but this shouldn't be necessary. For the dynamic cast thing, I can't say if I don't know what the linking errors are. With static cast you're removing a runtime check, but if you know how to keep your code safe that way go ahead. The assert fails when you used Animation.set_var or any of the callback setters in template form and you try to use one callback setter in non-template form. You would replace the pointer to the callbacks stored in the C structure and make some previously-defined callbacks to fail. Post the bit of code where you define the animation object and callbacks and we can see what should be amended.
Hello! I'm trying to use lvglpp in a Platform IO project. When I start building it, errors occurs like below:
The platform is esp32-s3, and the C++ standard is set to gnu++2a.
Thank you!