我只是复制并粘贴了here中的代码:
#include <..\cppwinrt\winrt\windows.networking.vpn.h>
using namespace winrt::Windows::Networking::Vpn;
int wmain()
{ VpnManagementAgent vpn;
auto profiles = vpn.getProfilesAsync().get();
wprintf(L"Found %d profiles\n", profiles.Size());
for (auto vp : profiles)
{
wprintf(L"Found profile %s\n", vp.ProfileName().c_str());
}}
我知道我还没有初始化Windows运行时,但是与我得到的错误无关:
so.cpp(7): error C2039: 'getProfilesAsync': is not a member of 'winrt::Windows::Networking::Vpn::VpnManagementAgent'
我已经完成研究,getProfilesAsync
中肯定有windows.networking.vpn.h
,但是我不知道该怎么去。