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