aj3423
aj3423

Reputation: 2561

compile error with urdl

I downloaded the http library urdl, trying to compile the example from the doc(http://think-async.com/Urdl/doc/html/urdl/getting_started/setting_options_to_perform_an_http_post.html):

#define URDL_HEADER_ONLY 1
#include <boost/array.hpp>
#include <urdl/http.hpp>
#include <urdl/istream.hpp>


int main() {
    urdl::istream is;

    is.set_option(urdl::http::request_method("POST"));
    is.set_option(urdl::http::request_content_type("text/plain"));
    is.set_option(urdl::http::request_content("Hello, world!"));
    is.open("http://somehost/path");
}

the compile error:

g:\boost\boost/asio/detail/handler_invoke_helpers.hpp(37) : error C2666: 'urdl::
detail::asio_handler_invoke' : 3 overloads have similar conversions
        g:\urdl\include\urdl/detail/http_read_stream.hpp(488): could be 'void ur
dl::detail::asio_handler_invoke<Function>(const Function &,urdl::detail::http_re
ad_stream<Stream>::read_handler<Handler> *)' [found using argument-dependent loo
kup]
        with
        [
....

The environment is Win7+VS2010, any idea?

Thanks.

Upvotes: 2

Views: 477

Answers (2)

chhenning
chhenning

Reputation: 2077

In boost asio header "handler_invoke_helpers.hpp" change:

using boost::asio::asio_handler_invoke;
asio_handler_invoke(function, boost::asio::detail::addressof(context));

to

boost::asio::asio_handler_invoke(function, boost::asio::detail::addressof(context));

That worked for me

Upvotes: 1

user3581075
user3581075

Reputation: 71

Yes, you are right, in the new version boost added a template function named asio_handler_invoke, which conflicts with the function defined at "http_read_stream.hpp(488)". Solution is to comment the user defined function.

Upvotes: 1

Related Questions