I tried to compile the example: echo_server_with_as_single_default.cpp
from boost examples on an:
Using the following commands to compile&link (I know it's not optimal, I reused the makefile from another project I am working on):
g++ -MT bin/.o/src/main.o -MD -MP -MF bin/.d/src/main.d -std=c++20 -Isrc -Ilib/ -g -Wfatal-errors -c -o bin/.o/src/main.o src/main.cpp
g++ -o bin/server bin/.o/src/main.o -lpthread -lrt -lboost_system -lboost_thread -lboost_chrono -lboost_context -lboost_coroutine -DBOOST_COROUTINES_NO_DEPRECATION_WARNING
And I get the following error:
I tried diferrent combinations but there is something I am missing. Any help?
error: 'awaitable' has not been declared in 'boost::asio'
22 | using boost::asio::awaitable;
Currently, coroutines are not enabled by default in gcc. You need to pass the -fcoroutines
compiler switch in order to enable them. This will probably change soon as it already works with the current gcc trunk version.
See here (I had to comment out the code in main due to the execution time cap in godbolt.org).