How to use cpp-netlib with already installed Boost

375 views
Skip to first unread message

Pavel Odintsov

unread,
Jun 22, 2016, 2:35:04 AM6/22/16
to The C++ Network Library
Hi, folks!

I've custom boost build in folder /opt/dps/libraries/boost_1_60_0. 

And I'm building cpp-netlib with following commands:
mkdir build
cd build
BOOST_ROOT=/opt//dps/libraries/boost_1_60_0 cmake .. -DCMAKE_INSTALL_PREFIX=/opt/dps/libraries/cpp_netlib_0_12_0
make -j
make install

But when I try to compile my example tool:
#include <iostream>
#include <boost/network/protocol/http/client.hpp>

using namespace boost::network;

int main() {
    std::string url = "ya.ru";
    http::client client;
    http::client::request request(url);
    request << header("Connection", "close");
    http::client::response response = client.get(request);
    std::cout << body(response) << std::endl;
}


I've got a lot of errors similar to this error:
/opt/dps/libraries/cpp_netlib_0_12_0/include/boost/network/uri/builder.hpp:9:31: fatal error: asio/ip/address.hpp: No such file or directory

So I decided to replace "#include <asio/" by "#include <boost/asio" but then I've got a lot of more complex errors about "error: no match for call to ‘(boost::network::http::impl::http_async_connection<Tag, version_major, version_minor>::start(const request&," and "error: boost::asio::detail::wrapped_handler<boost::asio::io_service::strand std::size_t)>’, is used but never defined [-fpermissive]".

What's correct way how I could install cpp-netlib and use with my application?

Thanks a lot!

Pavel Odintsov

unread,
Jun 22, 2016, 3:36:09 AM6/22/16
to The C++ Network Library
Well. I read maillist carefully and switched to the Git version 8ca59eb5590cb7404c8689c9541481c42f7c71ce.

But I'm still have few issues. First of all, when I do "make install" following library is no installed correctly "include/network/uri/uri.hpp". I need to copy it manually into includes path.

And I could not build dynamic libraries for cpp-netlib and haven't idea how I could do it. 

Could you help me for this two issues? 
Reply all
Reply to author
Forward
0 new messages