Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::function target must be copy-constructible #5

Open
rodgull opened this issue Nov 17, 2024 · 0 comments
Open

std::function target must be copy-constructible #5

rodgull opened this issue Nov 17, 2024 · 0 comments

Comments

@rodgull
Copy link

rodgull commented Nov 17, 2024

Hi,
I used your gnat project on an ESP32 3 years ago and got it running ok.

I have now updated to the latest ESP IDF and I can't compile the server.h file.
I have renamed server.h to MQTTBroker.h to improve clarity in my codebase, but have not changed the fundamental operation.

I tried changing the std::function to std::move_only_function but that gave a different set of errors.

I really don't understand c++ well enough to properly debug this and don't know how to fix it.

Maybe the issue is with the unique_ptr in the DataStoreEntry?

The full error is:

main/include/gnat/mqtt_broker.h:172:15: required from 'gnat::Status gnat::MQTTBroker<DataStore, Clock>::HandleMessage(gnat::Packet*) [with ClientConnection = AcTcpConnection; DataStore = gnat::DataStore<std::__cxx11::basic_string >; Clock = ClockWrapper]'
main/ac_mqtt_connection.cpp:73:42: required from here
/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:439:69: error: static assertion failed: std::function target must be copy-constructible
439 | static_assert(is_copy_constructible<__decay_t<_Functor>>::value,
| ^~~~~
/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:439:69: note: 'std::integral_constant<bool, false>::value' evaluates to false
[19/25] Building CXX object esp-idf/main/CMakeFiles/__idf_main.dir/ac_mqtt_server.cpp.obj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant