0

I have been trying to get this small program to work but keep getting compiler errors. I am using VS 2019 on windows and following this document. The program just gets the header of www.example.com and outputs the body response using the cpp-netlib library.

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

int main()
{
    boost::network::http::client client;
    boost::network::http::client::request request("http://www.example.com");
    request << boost::network::header("Connection", "close");
    boost::network::http::client::response response = client.get(request);

    std::cout << body(response);
}

I get the following errors from VS:

Error   C2039   'get_io_service': is not a member of 'boost::asio::ip::basic_resolver<boost::asio::ip::udp,boost::asio::any_io_executor>'   Project2    C:\Program Files\cpp-netlib\cpp-netlib-0.13.0-final\boost\network\protocol\http\client\connection\async_base.hpp    62  

Error   C3536   'delegate': cannot be used before it is initialized Project2    C:\Program Files\cpp-netlib\cpp-netlib-0.13.0-final\boost\network\protocol\http\client\connection\async_base.hpp    67  

But the documentation says to compile using CMake which I have tried but cannot get it to work. Any help at all would be greatly appreciated.

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.