Using coroutines in ASIO

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using coroutines in ASIO

Boost - Users mailing list
Hi there, I am trying to compile the asio co-routine example but as far as I can tell boost is looking for an <experimental/coroutine> header that does not exist on my system. I am using boost 1.71 and gcc on ubuntu 20.04. I tried both stock gcc (v9 on ubuntu) which does not have a coroutine header and gcc 10 which does have it but not under the experimental directory.

Here is the output with gcc 10:
/usr/lib/ccache/g++   -I../../src -g   -Wall   -pedantic   -Wextra   -Werror   -DASIO_HAS_CO_AWAIT   -DBOOST_ASIO_HAS_CO_AWAIT   -fcoroutines   --std=c++2a   -fdiagnostics-color -MD -MT CMakeFiles/mcbridge.dir
/src/main.cpp.o -MF CMakeFiles/mcbridge.dir/src/main.cpp.o.d -o CMakeFiles/mcbridge.dir/src/main.cpp.o -c ../../src/main.cpp
In file included from /usr/include/boost/asio/co_spawn.hpp:22,
                from ../../src/main.cpp:4:
/usr/include/boost/asio/awaitable.hpp:22:10: fatal error: experimental/coroutine: No such file or directory
  22 | #include <experimental/coroutine>



Any ideas on how to compile this example?

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Using coroutines in ASIO

Boost - Users mailing list
I believe there's a fix for this about to come out in boost 1.73

Until then it will work with clang9 -fcoroutines-ts -stdlib=libc++

It's because gcc went straight to the c++20 version of coroutines without stopping fot coroutines.ts.



On Sun, 26 Apr 2020 at 00:49, Pedro Pinto via Boost-users <[hidden email]> wrote:
Hi there, I am trying to compile the asio co-routine example but as far as I can tell boost is looking for an <experimental/coroutine> header that does not exist on my system. I am using boost 1.71 and gcc on ubuntu 20.04. I tried both stock gcc (v9 on ubuntu) which does not have a coroutine header and gcc 10 which does have it but not under the experimental directory.

Here is the output with gcc 10:
/usr/lib/ccache/g++   -I../../src -g   -Wall   -pedantic   -Wextra   -Werror   -DASIO_HAS_CO_AWAIT   -DBOOST_ASIO_HAS_CO_AWAIT   -fcoroutines   --std=c++2a   -fdiagnostics-color -MD -MT CMakeFiles/mcbridge.dir
/src/main.cpp.o -MF CMakeFiles/mcbridge.dir/src/main.cpp.o.d -o CMakeFiles/mcbridge.dir/src/main.cpp.o -c ../../src/main.cpp
In file included from /usr/include/boost/asio/co_spawn.hpp:22,
                from ../../src/main.cpp:4:
/usr/include/boost/asio/awaitable.hpp:22:10: fatal error: experimental/coroutine: No such file or directory
  22 | #include <experimental/coroutine>



Any ideas on how to compile this example?
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users


--
Richard Hodges
office: +442032898513
home: +376841522
mobile: +376380212


_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users