用urdl编译错误

时间:2014-07-26 08:06:41

标签: c++ boost compiler-errors

我下载了http库 urdl ,试图从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");
}

编译错误:

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
        [
....

环境是Win7 + VS2010,任何想法?

感谢。

2 个答案:

答案 0 :(得分:1)

是的,你是对的,在新版本中,boost添加了一个名为foreach (string Tablename in uniqueFields) { List<string> TblName = Tablename;//here the problem TblName = new List<string>(); Console.WriteLine("children of :" + TblName); foreach (string TableAssociatedValue in fields) { if (TableAssociatedValue.Contains(Tablename.Trim())) { Console.WriteLine(TableAssociatedValue); } } } 的模板函数,它与“http_read_stream.hpp(488)”中定义的函数冲突。解决方案是评论用户定义的函数。

答案 1 :(得分:1)

在boost asio标题“handler_invoke_helpers.hpp”中更改:

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

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

这对我有用