fatal error: asio/buffer.hpp: No such file or directory

472 views
Skip to first unread message

Karthick Jaganathan

unread,
Jul 17, 2016, 9:56:46 PM7/17/16
to The C++ Network Library
I got this error when trying to build sample http server.   Any pointers to resolve this? 

----------
jaganathan@localdev:~....$ make http_server
g++  -std=c++11 -I./include/ -I../../../libraries/boost/v1.61.0/build/include/ -I../../../libraries/cpp-netlib/bin/include -g -DBOOST_DATE_TIME_NO_LIB -DBOOST_REGEX_NO_LIB   -c -o HttpServer.o HttpServer.cpp
In file included from ../../../libraries/cpp-netlib/bin/include/boost/network/protocol/http/response.hpp:75:0,
                 from ../../../libraries/cpp-netlib/bin/include/boost/network/protocol/http/server.hpp:13,
                 from HttpServer.cpp:1:
../../../libraries/cpp-netlib/bin/include/boost/network/protocol/http/impl/response.ipp:19:27: fatal error: asio/buffer.hpp: No such file or directory
 #include <asio/buffer.hpp>
----------

I have boost 1.61 built in a local folder. 

jaganathan@localdev:~/Desktop/Projects/libraries$ ls
boost  
cpp-netlib

jaganathan@localdev:~/Desktop/Projects/libraries$ cd boost/v1.61.0/build/
jaganathan@localdev:~/Desktop/Projects/libraries/boost/v1.61.0/build$ ls
include  lib

jaganathan@localdev:~/Desktop/Projects/libraries/boost/v1.61.0/build$ find . -name buffer.hpp | grep asio
./include/boost/asio/buffer.hpp
./include/boost-1_61/boost/asio/buffer.hpp

----------

I have cpp-netlib built in a local folder too.
jaganathan@localdev:~/Desktop/Projects/libraries/boost/v1.61.0/build$ cd ../../../cpp-netlib/bin/
jaganathan@localdev:~/Desktop/Projects/libraries/cpp-netlib/bin$ ls
include  lib
jaganathan@localdev:~/Desktop/Projects/libraries/cpp-netlib/bin$ find . -name buffer.hpp | grep asio

----------

Sample HttpServer.cpp

#include <boost/network/protocol/http/server.hpp>
#include <string>
#include <iostream>

namespace http = boost::network::http;

struct handler;
typedef http::server<hello_world> server;

struct handler {
    void operator() (http_server::request const &request,
                     http_server::response &response) {
        response = http_server::response::stock_reply(
            http_server::response::ok, "Hello, world!");
    }

    void log(http_server::string_type const &info) {
        std::cerr << "ERROR: " << info << '\n';
    }
};

int
main(int argc, char * argv[]) {
    handler handler_;
    http_server::options options(handler_);
    http_server server_(
        options.address("0.0.0.0")
               .port("8000"));
    server_.run();
}
----------

Thanks,
Karthick

Karthick Jaganathan

unread,
Aug 3, 2016, 6:49:21 AM8/3/16
to The C++ Network Library
This was resolved.  There was an earlier post that had the same issue which provide clue

KSL

unread,
Oct 13, 2016, 6:30:59 AM10/13/16
to The C++ Network Library

On Wednesday, 3 August 2016 11:49:21 UTC+1, Karthick Jaganathan wrote:
This was resolved.  There was an earlier post that had the same issue which provide clue

Hi, I can't find the earlier post that resolves this issue. Found this on GitHub and I've posted a question about the workaround.

Can anyone help?
Reply all
Reply to author
Forward
0 new messages