crypto-chassis / ccapi

A header-only C++ library for interacting with crypto exchanges. Bindings for Python, Java, C#, Go, and Javascript are provided.
https://discord.gg/b5EKcp9s8T
MIT License
568 stars 195 forks source link

comile source code example with boost_beast failed (bind_front_wrapper) #401

Closed sylinuxhy closed 1 year ago

sylinuxhy commented 1 year ago

i compiled the source code (branch:origin/develop ) failed

linux: ubuntu16 LTS gcc: gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~16.04) boost:1.80

error_msg: In file included from /nfs/ccapi/example/build/boost/boost/beast/core/bind_handler.hpp:14:0, from /nfs/ccapi/example/build/boost/boost/beast/core/async_base.hpp:14, from /nfs/ccapi/example/build/boost/boost/beast/core.hpp:15, from /nfs/ccapi/include/ccapi_cpp/service/ccapi_service.h:22, from /nfs/ccapi/include/ccapi_cpp/service/ccapi_market_data_service.h:12, from /nfs/ccapi/include/ccapi_cpp/service/ccapi_market_data_service_coinbase.h:5, from /nfs/ccapi/include/ccapi_cpp/ccapi_session.h:8, from /nfs/ccapi/example/src/market_data_simple_request/main.cpp:1: /nfs/ccapi/example/build/boost/boost/beast/core/detail/bind_handler.hpp: In instantiation of ‘boost::beast::detail::bind_front_wrapper<Handler, Args>::bind_frontwrapper(Handler&&, Args&& ...) [with Handler = boost::beast::detail::bind_front_wrapper<void (ccapi::Service::)(std::shared_ptr, boost::beast::websocket::frame_type, boost::basic_string_view<char, std::char_traits >), std::shared_ptr, std::sharedptr >&; Args = {}; Handler = void (ccapi::Service::)(std::shared_ptr, boost::beast::websocket::frame_type, boost::basic_string_view<char, std::char_traits >); Args = {std::shared_ptr, std::shared_ptr}]’: /usr/include/c++/7/bits/std_function.h:192:6: required from ‘static void std::_Function_base::_Base_manager<_Functor>::_M_clone(std::_Any_data&, const std::_Any_data&, std::false_type) [with _Functor = boost::beast::detail::bind_front_wrapper<void (ccapi::Service::)(std::shared_ptr, boost::beast::websocket::frame_type, boost::basic_string_view<char, std::char_traits >), std::shared_ptr, std::shared_ptr >; std::false_type = std::integral_constant<bool, false>]’ /usr/include/c++/7/bits/std_function.h:227:16: required from ‘static bool std::_Function_base::_Base_manager<_Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Functor = boost::beast::detail::bind_front_wrapper<void (ccapi::Service::)(std::shared_ptr, boost::beast::websocket::frame_type, boost::basic_string_view<char, std::char_traits >), std::shared_ptr, std::shared_ptr >]’ /usr/include/c++/7/bits/std_function.h:695:19: required from ‘std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = boost::beast::detail::bind_front_wrapper<void (ccapi::Service::)(std::shared_ptr, boost::beast::websocket::frame_type, boost::basic_string_view<char, std::char_traits >), std::shared_ptr, std::shared_ptr >; = void; = void; _Res = void; _ArgTypes = {boost::beast::websocket::frame_type, boost::basic_string_view<char, std::char_traits >}]’ /nfs/ccapi/include/ccapi_cpp/service/ccapi_service.h:1303:120: required from here /nfs/ccapi/example/build/boost/boost/beast/core/detail/bind_handler.hpp:254:45: error: cannot convert ‘boost::beast::detail::bind_front_wrapper<void (ccapi::Service::)(std::shared_ptr, boost::beast::websocket::frame_type, boost::basic_string_view<char, std::char_traits >), std::shared_ptr, std::shared_ptr >’ to ‘void (ccapi::Service::*)(std::shared_ptr, boost::beast::websocket::frame_type, boost::basic_string_view<char, std::chartraits >)’ in initialization , args(std::forward(args)...) ^ src/market_data_simple_request/CMakeFiles/market_data_simple_request.dir/build.make:62: recipe for target 'src/market_data_simple_request/CMakeFiles/market_data_simple_request.dir/main.cpp.o' failed make[2]: [src/market_data_simple_request/CMakeFiles/market_data_simple_request.dir/main.cpp.o] Error 1 CMakeFiles/Makefile2:203: recipe for target 'src/market_data_simple_request/CMakeFiles/market_data_simple_request.dir/all' failed make[1]: [src/market_data_simple_request/CMakeFiles/market_data_simple_request.dir/all] Error

cryptochassis commented 1 year ago

Sorry that we aren't unable to get ubuntu16 to reproduce the issue. The oldest ubuntu OS that we can find on AWS EC2 from searches in several different regions is Ubuntu 20.04. We do have CI on latest ubuntu which passed: https://github.com/crypto-chassis/ccapi/actions/runs/5437916257/jobs/9888789327.