chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.72k stars 1.19k forks source link

ASIO compile error #343

Closed suneeshs closed 5 years ago

suneeshs commented 5 years ago

Im trying to compile eProsima/Fast-RTPS with the latest version of asio (1.12.1) for QNX Neutrino and I get a compile error. Just wondering if you are able to make any suggestions regarding this. Thanks!

Error:

In file included from L:/eProsima/Fast-RTPS/thirdparty/asio/asio/include/asio/detail/executor_op.hpp:20:0, from L:/eProsima/Fast-RTPS/thirdparty/asio/asio/include/asio/impl/system_executor.hpp:18, from L:/eProsima/Fast-RTPS/thirdparty/asio/asio/include/asio/system_executor.hpp:127, from L:/eProsima/Fast-RTPS/thirdparty/asio/asio/include/asio/associated_executor.hpp:21, from L:/eProsima/Fast-RTPS/thirdparty/asio/asio/include/asio.hpp:19, from L:/eProsima/Fast-RTPS/include/fastrtps/rtps/resources/ResourceEvent.h:25, from L:/eProsima/Fast-RTPS/src/cpp/rtps/resources/ResourceEvent.cpp:20: L:/eProsima/Fast-RTPS/thirdparty/asio/asio/include/asio/detail/completion_handler.hpp: In instantiation of 'static asio::detail::completion_handler asio::detail::completion_handler::ptr::allocate(Handler&) [with Handler = std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>]': L:/eProsima/Fast-RTPS/thirdparty/asio/asio/include/asio/impl/io_context.hpp:184:24: required from 'typename asio::async_result<typename std::__1::decay<_Tp>::type, void()>::return_type asio::io_context::post(LegacyCompletionHandler&&) [with LegacyCompletionHandler = std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>; typename asio::async_result<typename std::1::decay<_Tp>::type, void()>::return_type = void]' L:/eProsima/Fast-RTPS/src/cpp/rtps/resources/ResourceEvent.cpp:62:72: required from here L:/eProsima/Fast-RTPS/thirdparty/asio/asio/include/asio/detail/handler_alloc_helpers.hpp:168:68: error: no matching function for call to 'std::1::allocator_traits<asio::detail::hook_allocator<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>, void> >::rebind_alloc<asio::detail::completion_handler<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent> > >::rebind_alloc(asio::detail::get_hook_allocator<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>, std::1::allocator >::type)' handler, ::asio::get_associated_allocator(handler))); \ ^ L:/eProsima/Fast-RTPS/thirdparty/asio/asio/include/asio/detail/completion_handler.hpp:34:3: note: in expansion of macro 'ASIO_DEFINE_HANDLER_PTR' ASIO_DEFINE_HANDLER_PTR(completion_handler); ^ In file included from c:\qnx700\target\qnx7\usr\include\c++\v1\functional:477:0, from c:\qnx700\target\qnx7\usr\include\c++\v1\thread:93, from L:/eProsima/Fast-RTPS/include/fastrtps/rtps/resources/ResourceEvent.h:24, from L:/eProsima/Fast-RTPS/src/cpp/rtps/resources/ResourceEvent.cpp:20: c:\qnx700\target\qnx7\usr\include\c++\v1\memory:1471:33: note: candidate: constexpr std::1::allocator_traits<asio::detail::hook_allocator<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>, void> >::rebind_alloc<asio::detail::completion_handler<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent> > >::rebind_alloc() template struct rebind_alloc ^ c:\qnx700\target\qnx7\usr\include\c++\v1\memory:1471:33: note: candidate expects 0 arguments, 1 provided c:\qnx700\target\qnx7\usr\include\c++\v1\memory:1471:33: note: candidate: constexpr std::1::allocator_traits<asio::detail::hook_allocator<std::1::__bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>, void> >::rebind_alloc<asio::detail::completion_handler<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent> > >::rebind_alloc(const std::1::allocator_traits<asio::detail::hook_allocator<std::1::__bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>, void> >::rebind_alloc<asio::detail::completion_handler<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent> > >&) c:\qnx700\target\qnx7\usr\include\c++\v1\memory:1471:33: note: no known conversion for argument 1 from 'asio::detail::get_hook_allocator<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>, std::__1::allocator >::type {aka asio::detail::hook_allocator<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>, void>}' to 'const std::1::allocator_traits<asio::detail::hook_allocator<std::1::__bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>, void> >::rebind_alloc<asio::detail::completion_handler<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent> > >&' c:\qnx700\target\qnx7\usr\include\c++\v1\memory:1471:33: note: candidate: constexpr std::1::allocator_traits<asio::detail::hook_allocator<std::1::__bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>, void> >::rebind_alloc<asio::detail::completion_handler<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent> > >::rebind_alloc(std::1::allocator_traits<asio::detail::hook_allocator<std::1::__bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>, void> >::rebind_alloc<asio::detail::completion_handler<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent> > >&&) c:\qnx700\target\qnx7\usr\include\c++\v1\memory:1471:33: note: no known conversion for argument 1 from 'asio::detail::get_hook_allocator<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>, std::__1::allocator >::type {aka asio::detail::hook_allocator<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>, void>}' to 'std::1::allocator_traits<asio::detail::hook_allocator<std::1::__bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent>, void> >::rebind_alloc<asio::detail::completion_handler<std::1::bind<void (eprosima::fastrtps::rtps::ResourceEvent::)(), eprosima::fastrtps::rtps::ResourceEvent*> > >&&'

tongtongdi commented 2 years ago

How did you solve this problem?

bseker commented 1 year ago

I am also wondering how this issue is resolved.

bseker commented 1 year ago

I had a similar issue, and it is solved by adding set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Y_gpp") to my cmake file.

reference: https://discourse.cmake.org/t/qnx-cmake-build/1309/2