从 cpprestsdk 创建 http_client 实例的异常

问题描述

我使用的是 Visual Studio 2017。我已经通过 vcpckg 安装了 cpprestsdk (2.10.18)。我根据https://github.com/microsoft/cpprestsdk/wiki/Getting-Started-Tutorial做了第一次尝试。创建 http_client 的实例会引发异常。 URI 参数似乎是正确的。我已经将代码精简为这个

#include <cpprest/http_client.h>

using namespace web::http::client;


int main() {

    http_client client(L"https://api.predic8.de");
    
    //....

    return 0;
}

调用栈:

>   cpprestsdk.exe!std::_Container_base12::_Orphan_all() Line 221   C++
    cpprestsdk.exe!std::_String_alloc<std::_String_base_types<wchar_t,std::allocator<wchar_t> > >::_Orphan_all() Line 2024  C++
    cpprestsdk.exe!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::_Tidy_deallocate() Line 3986  C++
    cpprestsdk.exe!std::basic_string<wchar_t,std::allocator<wchar_t> >::~basic_string<wchar_t,std::allocator<wchar_t> >() Line 2460 C++
    cpprestsdk.exe!web::details::uri_components::~uri_components()  C++
    cpprestsdk.exe!web::uri::~uri() C++
    cpprestsdk.exe!main() Line 16   C++
    [External Code] 

在 Windows 10 机器上构建是 Debug/x64

我做错了什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)