the Following is quick-start program of WinRT:
// WinRT.cpp
// Single source file runs
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Web.Syndication.h>
#include <iostream>
#pragma comment(lib, "windowsapp.lib")
using namespace winrt;
using namespace Windows::Foundation;
using namespace Windows::Web::Syndication;
int main()
{
winrt::init_apartment();
Uri rssFeedUri{ L"https://blogs.windows.com/feed" };
SyndicationClient syndicationClient;
SyndicationFeed syndicationFeed = syndicationClient.RetrieveFeedAsync(rssFeedUri).get();
for (const SyndicationItem syndicationItem : syndicationFeed.Items())
{
winrt::hstring titleAsHstring = syndicationItem.Title().Text();
std::wcout << titleAsHstring.c_str() << std::endl;
}
}
I've configured my compiler platform in Microsoft's tutorial, But Run failed and just throw an Exception:
Exception thrown at 0x00007FFD9C78A839 in WinRT.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x000000F009CFFA00.
What went wrong? Thanks in advance.