0

I'm using cpprestsdk for a Http client in my code as given below:

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();
    });
}

I'm getting this strange set of compiler errors stated in the question header for multiple files. One example reference the error is point to is in http_client.h:

const utf16string &content_type = ::utility::conversions::to_utf16string("text/plain"),

in which there's nothing before the ::utility. This happens in multiple places and it's not my code. This is straight from SDK. I downloaded the API using NuGet package manager. Help please. Thanks.

Mixhab
  • 421
  • 3
  • 14
kovac
  • 4,945
  • 9
  • 47
  • 90
  • This is fine, it names the global namespace. What compiler are you using that chokes on it? – Quentin Dec 25 '17 at 14:57
  • @Quentin I'm using Visual Studio 2017 to build it. This library seems out of whack. I'm going through their GitHub issues as well. May have to switch to some other library... – kovac Dec 25 '17 at 14:58
  • That's strange, I cannot reproduce it with an online VS compiler. Could you try copying that line and giving it enough context to reproduce the error without hauling the SDK around? – Quentin Dec 25 '17 at 15:02
  • @Quentin I get the same error with the tutorial given at https://github.com/Microsoft/cpprestsdk/wiki/Getting-Started-Tutorial. I'm using Visual Studio 2017 and Package Manager Console Host Version 4.5.0.4685. I simply installed the sdk, copied the example and tried to compile and I get the error I posted. – kovac Dec 25 '17 at 15:05
  • I'm asking because many people here don't have the time or the means (I don't have a Windows box) to set that up and test. But this looks like a basic syntax problem not related to the SDK at all, hence the value of trying to isolate it (here's an [online compiler](http://rextester.com)). But it's alright if you can't get it to show up there :) – Quentin Dec 25 '17 at 15:14

0 Answers0