title: How to build boost::asio::experimental
body: <p>I want to build an example from the page: <a href="https://www.boost.org/doc/libs/1_69_0/doc/html/boost_asio/example/cpp17/coroutines_ts/chat_server.cpp" rel="nofollow noreferrer">https://www.boost.org/doc/libs/1_69_0/doc/html/boost_asio/example/cpp17/coroutines_ts/chat_server.cpp</a></p>
  
  <p>G++ version: 7.3
  Boost version 1.69</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;deque&gt;
  #include &lt;iostream&gt;
  #include &lt;list&gt;
  #include &lt;memory&gt;
  #include &lt;set&gt;
  #include &lt;string&gt;
  #include &lt;utility&gt;
  #include &lt;boost/asio/experimental.hpp&gt;
  #include &lt;boost/asio/io_context.hpp&gt;
  #include &lt;boost/asio/ip/tcp.hpp&gt;
  #include &lt;boost/asio/read_until.hpp&gt;
  #include &lt;boost/asio/signal_set.hpp&gt;
  #include &lt;boost/asio/steady_timer.hpp&gt;
  #include &lt;boost/asio/write.hpp&gt;
  
  using boost::asio::ip::tcp;
  using boost::asio::experimental::awaitable;
  using boost::asio::experimental::co_spawn;
  using boost::asio::experimental::detached;
  using boost::asio::experimental::redirect_error;
  namespace this_coro = boost::asio::experimental::this_coro;
  
  //----------------------------------------------------------------------
  
  class chat_participant
  {
  public:
    virtual ~chat_participant() {}
    virtual void deliver(const std::string&amp; msg) = 0;
  };
  
  typedef std::shared_ptr&lt;chat_participant&gt; chat_participant_ptr;
  
  //----------------------------------------------------------------------
  
  class chat_room
  {
  public:
    void join(chat_participant_ptr participant)
    {
      participants_.insert(participant);
      for (auto msg: recent_msgs_)
        participant-&gt;deliver(msg);
    }
  
    void leave(chat_participant_ptr participant)
    {
      participants_.erase(participant);
    }
  
    void deliver(const std::string&amp; msg)
    {
      recent_msgs_.push_back(msg);
      while (recent_msgs_.size() &gt; max_recent_msgs)
        recent_msgs_.pop_front();
  
      for (auto participant: participants_)
        participant-&gt;deliver(msg);
    }
  
  private:
    std::set&lt;chat_participant_ptr&gt; participants_;
    enum { max_recent_msgs = 100 };
    std::deque&lt;std::string&gt; recent_msgs_;
  };
  
  //----------------------------------------------------------------------
  
  class chat_session
    : public chat_participant,
      public std::enable_shared_from_this&lt;chat_session&gt;
  {
  public:
    chat_session(tcp::socket socket, chat_room&amp; room)
      : socket_(std::move(socket)),
        timer_(socket_.get_executor().context()),
        room_(room)
    {
      timer_.expires_at(std::chrono::steady_clock::time_point::max());
    }
  
    void start()
    {
      room_.join(shared_from_this());
  
      co_spawn(socket_.get_executor(),
          [self = shared_from_this()]{ return self-&gt;reader(); },
          detached);
  
      co_spawn(socket_.get_executor(),
          [self = shared_from_this()]{ return self-&gt;writer(); },
          detached);
    }
  
    void deliver(const std::string&amp; msg)
    {
      write_msgs_.push_back(msg);
      timer_.cancel_one();
    }
  
  private:
    awaitable&lt;void&gt; reader()
    {
      auto token = co_await this_coro::token();
  
      try
      {
        for (std::string read_msg;;)
        {
          std::size_t n = co_await boost::asio::async_read_until(socket_,
              boost::asio::dynamic_buffer(read_msg, 1024), "\n", token);
  
          room_.deliver(read_msg.substr(0, n));
          read_msg.erase(0, n);
        }
      }
      catch (std::exception&amp;)
      {
        stop();
      }
    }
  
    awaitable&lt;void&gt; writer()
    {
      auto token = co_await this_coro::token();
  
      try
      {
        while (socket_.is_open())
        {
          if (write_msgs_.empty())
          {
            boost::system::error_code ec;
            co_await timer_.async_wait(redirect_error(token, ec));
          }
          else
          {
            co_await boost::asio::async_write(socket_,
                boost::asio::buffer(write_msgs_.front()), token);
            write_msgs_.pop_front();
          }
        }
      }
      catch (std::exception&amp;)
      {
        stop();
      }
    }
  
    void stop()
    {
      room_.leave(shared_from_this());
      socket_.close();
      timer_.cancel();
    }
  
    tcp::socket socket_;
    boost::asio::steady_timer timer_;
    chat_room&amp; room_;
    std::deque&lt;std::string&gt; write_msgs_;
  };
  
  //----------------------------------------------------------------------
  
  awaitable&lt;void&gt; listener(tcp::acceptor acceptor)
  {
    auto token = co_await this_coro::token();
  
    chat_room room;
  
    for (;;)
    {
      std::make_shared&lt;chat_session&gt;(
          co_await acceptor.async_accept(token),
          room
        )-&gt;start();
    }
  }
  
  //----------------------------------------------------------------------
  
  int main(int argc, char* argv[])
  {
    try
    {
      if (argc &lt; 2)
      {
        std::cerr &lt;&lt; "Usage: chat_server &lt;port&gt; [&lt;port&gt; ...]\n";
        return 1;
      }
  
      boost::asio::io_context io_context(1);
  
      for (int i = 1; i &lt; argc; ++i)
      {
        unsigned short port = std::atoi(argv[i]);
        co_spawn(io_context,
            [&amp;]{ return listener(tcp::acceptor(io_context, {tcp::v4(), port})); },
            detached);
      }
  
      boost::asio::signal_set signals(io_context, SIGINT, SIGTERM);
      signals.async_wait([&amp;](auto, auto){ io_context.stop(); });
  
      io_context.run();
    }
    catch (std::exception&amp; e)
    {
      std::cerr &lt;&lt; "Exception: " &lt;&lt; e.what() &lt;&lt; "\n";
    }
  
    return 0;
  }
  </code></pre>
  
  <p>Errors:</p>
  
  <pre><code>../src/ChatServer.cpp:28:34: error: ‘boost::asio::experimental::awaitable’ has not been declared
  ../src/ChatServer.cpp:29:34: error: ‘boost::asio::experimental::co_spawn’ has not been declared
  ../src/ChatServer.cpp:32:50: error: ‘this_coro’ is not a namespace-name
  </code></pre>