Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

hello_world example does not compile #581

Closed
@susnux

Description

@susnux

Using cpp-netlib 0.11.2, boost 1.54 and gcc 4.8.5 or gcc 5.2.1 compiling this example:
http://cpp-netlib.org/0.11.2/examples/http/hello_world_server.html
will fail.

First the example does not mention that a log handler is needed, this can be fixed with modifying the hello_world struct:

structhello_world {voidoperator() (server::requestconst &request,                     server::response &response) {        std::string ip =source(request);        response =server::response::stock_reply(            server::response::ok,std::string("Hello,") + ip +"!");    }voidlog(...) {    }};

But then it fails with:

g++-5 -std=c++11 -lcppnetlib-server-parsers -lboost_system -lboost_thread -pthread a.cpp :(

a.cpp: In function ‘int main(int, char*)’:
a.cpp:31:49: error: no matching function for call to ‘boost::network::http::server<hello_world>::server(char
&, char*&, hello_world&)’
server server_(argv[1], argv[2], handler);
^
In file included from a.cpp:1:0:
/usr/include/boost/network/protocol/http/server.hpp:44:12: note: candidate: boost::network::http::server::server(const options&) [with Handler = hello_world; boost::network::http::server::options = boost::network::http::server_options<boost::network::http::tags::http_server, hello_world>]
explicit server(options const &options) : server_base(options) {}
^
/usr/include/boost/network/protocol/http/server.hpp:44:12: note: candidate expects 1 argument, 3 provided

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp