asio icon indicating copy to clipboard operation
asio copied to clipboard

using clang on windows failed to define some macro of asio

Open kiraYuukiAsuna opened this issue 1 year ago • 1 comments

take ASIO_HAS_CO_AWAIT for example:

if defined(ASIO_MSVC)
#   if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705) && !defined(__clang__)
#    define ASIO_HAS_CO_AWAIT 1
#   elif (_MSC_FULL_VER >= 190023506)
#    if !defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
#     define ASIO_HAS_CO_AWAIT 1
#    endif // defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
#   endif // (_MSC_FULL_VER >= 190023506)
#  elif defined(__clang__)

Since i use clang to compile my code, and as we know that clang on windows need to use msvc's header and library. This caused clang and _MSC_VER defined at the same time. Thus caused ASIO_HAS_CO_AWAIT not defined at config.hpp in asio library.

Can we handle this particularly circumstance?

Anyway, thanks for this awesome library!

kiraYuukiAsuna avatar Jun 04 '24 18:06 kiraYuukiAsuna

I also encountered the same issue. Temporary solution: Add the definition in "asio.hpp":

#if defined(__cpp_impl_coroutine)
#  define ASIO_HAS_CO_AWAIT 1
#endif

I'm not sure if this is appropriate.

StinkyTooFool avatar Jul 29 '24 08:07 StinkyTooFool