0

I simply copied and pasted the code from 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());
    }}

I know I've not initialized the windows runtime but that has nothing to do with the error I'm getting:

so.cpp(7): error C2039: 'getProfilesAsync': is not a member of 'winrt::Windows::Networking::Vpn::VpnManagementAgent'

I've done my research and there is definitely getProfilesAsync in windows.networking.vpn.h however I don't know how to reach it.

AnArrayOfFunctions
  • 3,452
  • 2
  • 29
  • 66
  • 2
    There seems to be a [`GetProfilesAsync`](https://learn.microsoft.com/en-us/uwp/api/windows.networking.vpn.vpnmanagementagent.getprofilesasync#Windows_Networking_Vpn_VpnManagementAgent_GetProfilesAsync) function, but no `getProfilesAsync`. Remember that C++ (and C++/CLI which you're using) is case-sensitive. – Some programmer dude Jul 05 '19 at 12:32
  • @Someprogrammerdude I honestly thought the library was broken. I knew that but since I was copying over from another question I assumed it was all fine. – AnArrayOfFunctions Jul 05 '19 at 12:39
  • You likely copied from the javascript samples. The APIs as projected into JavaScript are "re-cased" to match expectations for that language as part of how they're projected. – Ben Kuhn Jul 06 '19 at 06:56

0 Answers0