BeastHttp icon indicating copy to clipboard operation
BeastHttp copied to clipboard

Basic example in README.md does not compile.

Open NAThompson opened this issue 5 years ago • 2 comments

The first example in the USAGE section of the README.md does not compile. To wit, it is not clear which files must be #include'd in order to get it t run. After cycling through quite a different number of compile errors and header combinations, I got stuck here:

BeastHttp$ g++ --std=c++14 -Wfatal-errors -I./include -I../moetsi/dependencies/boost server.cpp -o runserver
In file included from server.cpp:6:0:
./include/reactor/listener.hxx:102:32: error: type/value mismatch at argument 4 in template parameter list for ‘template<template<class> class OnAccept, template<class> class OnError, class Protocol, template<class> class Acceptor, template<class> class Socket, template<class> class Endpoint> class _0xdead4ead::http::reactor::listener’
 using listener_type = listener<>;
                                  ^

where server.cpp consists of

#include <iostream>
#include <base/cb.hxx>
#include <base/regex.hxx>
#include <base/request_processor.hxx>
#include <reactor/listener.hxx>
#include <reactor/session.hxx>
#include <basic_router.hxx>
#include <out.hxx>
#include <boost/asio/posix/stream_descriptor.hpp>
#include <boost/asio/signal_set.hpp>
#include <thread>
#include <param.hxx>
#include <basic_router.hxx>
#include <chain_router.hxx>
#include <literals.hxx>
#include <boost/beast/http.hpp>

using namespace _0xdead4ead;

using HttpSession = http::reactor::_default::session_type;
using HttpListener = http::reactor::_default::listener_type;


int main()
{
    http::basic_router<HttpSession> router;

    router.get("^/$", [](auto request, auto context) {
        context.send(make_response(request, "MAIN PAGE\n"));
    });
}

I got a little closer by #include <unordered_map> in session.hxx, but still didn't get it to go through.

NAThompson avatar Apr 07 '19 17:04 NAThompson

You looked code examples?

0xdead4ead avatar Apr 08 '19 08:04 0xdead4ead

Yes.

NAThompson avatar Apr 08 '19 13:04 NAThompson