我在我的代码中将 cpprestsdk 用于 Http 客户端,如下所示:
std::string MyClass::GetPage(std::string url)
{
web::http::client::http_client httpClient(utility::conversions::to_string_t(url));
pplx::task<web::http::http_response> request = httpClient.request(web::http::methods::GET);
request.then([=](pplx::task<web::http::http_response> task)
{
// TODO: handle exceptions here.
web::http::http_response response = task.get();
return response.extract_string();
});
}
我在多个文件的问题标题中收到了一组奇怪的编译器错误。错误指向的一个示例参考位于http_client.h
:
const utf16string &content_type = ::utility::conversions::to_utf16string("text/plain"),
其中 . 之前没有任何内容::utility
。这发生在多个地方,这不是我的代码。这直接来自 SDK。我使用 NuGet 包管理器下载了 API。请帮忙。谢谢。