LNK2019: ссылка на неразрешенный внешний символ main в функции. ФАЙЛ: MSVCRT.lib

Проект CMake. Как я понял, ошибка связанна с компилятором, добавление в файл CMakeList.txt строки:

 set(CMAKE_CXX_FLAGS_DEBUG "/MD") 

проблему не решило. Как можно решить эту проблему?

Is there a way to set ALSA microphone as the main one?

I’m using Kubuntu 19.04 and i’m getting weird pop sounds at my microphone whenever I talk. I’ve recorded my mic via Pulseaudio and via ALSA (thanks to Audacity) and I noticed that the pops only appear in the Pulseaudio’s record.

I’ve already tried a lot of config solutions (and even tried to disable Pulseaudio), but unfortunately nothing worked.

Is there a way to select ALSA microphone as the system default?


Pulseaudio’s record: https://soundcloud.com/glhrml/pulseaudio-mic/s-aVhZ8

ALSA’s record: https://soundcloud.com/glhrml/alsa-mic/s-2bJwM

Exception in thread “main” org.openqa.selenium.UnsupportedCommandException: User prompt of type promptUserAndPass is not supported

Exception in thread “main” org.openqa.selenium.UnsupportedCommandException: User prompt of type promptUserAndPass is not supported

driver.switchTo().alert().sendKeys(proxyLogin + Keys.TAB + proxyPass); driver.switchTo().alert().accept(); 

перестало работать в версии firefox 67,68 кто то может подсказать оптимальное решение? спасибо

Keep sticky posts in the main loop, at their regular place

I have a wordpress theme that has a place at the top for sticky posts. If a post is set to sticky, it will show up at the top, but it will not be in the posts listed below.

How can I have the sticky posts inside the main loop? I deleted this function which hid them from the main loop:

public function modify_main_query( $  query ) { if ( $  query->is_home() && $  query->is_main_query() ) { $  query->query_vars['post__not_in'] = $  this->sticky_posts; } } 

After deleting this, the posts show in the main loop, but they show up at the top of the 10 items, before the rest.

How can I have them show at their respective dates, as if they were NOT sticky?

Thanks.

Retornar um vetor para a main – C

Gostaria de retornar um vetor para a main, acho que o erro está na parte de receber o endereço do vetor retornado.

Consigo fazer a passagem através de referência, porém, gostaria de aprender a retornar um vetor.

Críticas são sempre bem vindas.


int* fibonacci(int qtdTermos) {    int vet[3];    int sequenciaFibo[qtdTermos];     vet[0] = 1;    vet[1] = 1;    vet[2] = 2;     if (qtdTermos >= 1) { sequenciaFibo[0] = vet[0]; }    if (qtdTermos >= 2) { sequenciaFibo[1] = vet[1]; }    if (qtdTermos >= 3) { sequenciaFibo[2] = vet[2]; }    if (qtdTermos > 3) {       for (int i = 3; i < qtdTermos; i++) {          vet[0] = (vet[1]) + (vet[2]);          vet[1] = vet[2];          vet[2] = vet[0];          sequenciaFibo[i] = vet[2];      }   }     return sequenciaFibo; }  int main () {    int qtdTermos;    int *vet;     printf ("Informe a quantidade de termos: ");     scanf ("%i", &qtdTermos);     vet = fibonacci(qtdTermos); //Aqui     for (int i = 0; i < qtdTermos; i++) {       printf ("%i\n", vet[i]);    }     return 0; } 

C++ – Aplicar a herança/polimorfismo na método main

Estou tendo problemas com a utilização de herança/polimorfismo quando utilizo no método main. Como deve ser feita a alocação de memória?


#include <stdio.h> #include <string.h> #include <stdlib.h>  #define MAX 100  class Disciplina { protected:     int cod;     char nome[MAX];     int sem, ano, cred; public:     virtual void ler();     virtual float media();     int getCod()             { return cod; }     char *getNome(char *buf) { return strcpy(buf, nome); } //strcpy retorna a variável alterada 'buff'     int getSem()             { return sem; }     int getAno()             { return ano; }     int getCred()            { return cred; } };  class Disc1 : Disciplina { private:     float n1, n2; protected:     float getN1() { return n1; }     float getN2() { return n2; } public:     virtual void ler();     float media() { return (n1 + n2) /2; }; };  void Disc1::ler() {     printf ("Digite a Nota 1: ");     scanf ("%f", &n1);     printf ("Digite a Nota 2: ");     scanf ("%f", &n2);     printf ("Nome da Disciplina: ");     fflush(stdin);     scanf ("%[^\n]", nome);     printf ("Semestre: ");     scanf ("%i", &sem);     printf ("Ano: ");     scanf ("%i", &ano);     printf ("Credito: ");     scanf ("%i", &cred); }  class Disc2 : Disc1 { private:     float n3; public:     void ler();     float media() { return (n3 + ((getN1() + getN1())/2)) / 2; } };  void Disc2::ler() {     Disc1 ler();      if (media() >= 5 && media() < 7 ) {         printf ("Informe a Nota 3: ");         scanf ("%f", &n3);     } }  void criarTipo(Disciplina *x, int tipo) {      switch (tipo) {         case 1: x = new Disc1;         break;         case 2: x = new Disc2;         break;     } }  int main () {     Disciplina *x;      criarTipo(x, 2);      return 0; } 

What’s wrong with my VPN code – why am I being down-voted on the main site?

I have currently a code which demonstrate how useless is the UWP VPN namespace i.e. VpnManagementAgent.

It’s useless because I can’t get it to 1. enumerate existing profiles on my system 2. create a new one in case it doesn’t support the existing ones anyway.

Here is my C code which I think I’m being down-voted because:

#define COBJMACROS #include <roapi.h> #include <windows.networking.vpn.h> #include <stdbool.h> #include <stdio.h>  //Had to manually define my IIDs //because the definitions are missing from the library  const IID IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent = {0x193696CD,0xA5C4,0x4ABE,0x85,0x2B,0x78,0x5B,0xE4,0xCB,0x3E,0x34};  const IID IID___FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile = {0xdac6dd72,0xa5d1,0x56d4,0xaf,0xc4,0x98,0x9f,0x84,0xdc,0xb2,0xb3};  const IID IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile = {0x7875B751,0xB0D7,0x43DB,0x8A,0x93,0xD3,0xFE,0x24,0x79,0xE5,0x6A};  const IID IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnNativeProfile = {0xA4AEE29E,0x6417,0x4333,0x98,0x42,0xF0,0xA6,0x6D,0xB6,0x98,0x02};  const IID IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnChannel = {0x4AC78D07,0xD1A8,0x4303,0xA0,0x91,0xC8,0xD2,0xE0,0x91,0x5B,0xC3};  const IID IID___FIAsyncOperationCompletedHandler_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus = {0x31229f8c,0x709d,0x5017,0x86,0x29,0x57,0xef,0x12,0x89,0xe6,0x16};  const WCHAR pVPNXmlCode[] =   L"<SyncML xmlns=\"SYNCML:SYNCML1.2\" xmlns:A=\"syncml:metinf\">" L"  <SyncBody>" L"    <Atomic>" L"      <CmdID>10000</CmdID>" L"" L"      <!-- Configure VPN Server Name or Address (PhoneNumber=) [Comma Separated]-->" L"      <Add>" L"        <CmdID>10001</CmdID>" L"        <Item>" L"          <Target>" L"            <LocURI>./Vendor/MSFT/VPNv2/VPN_Demo/ProfileXML</LocURI>" L"          </Target>" L"          <Data><VPNProfile>" L"  <ProfileName>VPN_Demo</ProfileName>" L"  <NativeProfile>" L"    <Servers>VPNServer.contoso.com</Servers>" L"    <NativeProtocolType>Automatic</NativeProtocolType>" L"    <Authentication>" L"      <UserMethod>Eap</UserMethod>" L"      <Eap>" L"        <Configuration>" L"<EapHostConfig xmlns=\"http://www.microsoft.com/provisioning/EapHostConfig\"> <EapMethod> <Type xmlns=\"http://www.microsoft.com/provisioning/EapCommon\">25</Type> <VendorId xmlns=\"http://www.microsoft.com/provisioning/EapCommon\">0</VendorId> <VendorType xmlns=\"http://www.microsoft.com/provisioning/EapCommon\">0</VendorType> <AuthorId xmlns=\"http://www.microsoft.com/provisioning/EapCommon\">0</AuthorId> </EapMethod> <Config xmlns=\"http://www.microsoft.com/provisioning/EapHostConfig\"> <Eap xmlns=\"http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1\"> <Type>25</Type> <EapType xmlns=\"http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1\"> <ServerValidation> <DisableUserPromptForServerValidation>false</DisableUserPromptForServerValidation> <ServerNames></ServerNames> </ServerValidation> <FastReconnect>true</FastReconnect> <InnerEapOptional>false</InnerEapOptional> <Eap xmlns=\"http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1\"> <Type>13</Type> <EapType xmlns=\"http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV1\"> <CredentialsSource> <CertificateStore> <SimpleCertSelection>false</SimpleCertSelection> </CertificateStore> </CredentialsSource> <ServerValidation> <DisableUserPromptForServerValidation>false</DisableUserPromptForServerValidation> <ServerNames></ServerNames> </ServerValidation> <DifferentUsername>false</DifferentUsername> <PerformServerValidation xmlns=\"http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV2\">false</PerformServerValidation> <AcceptServerName xmlns=\"http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV2\">false</AcceptServerName> <TLSExtensions xmlns=\"http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV2\"> <FilteringInfo xmlns=\"http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV3\"> <EKUMapping> <EKUMap> <EKUName>Unknown Key Usage</EKUName> <EKUOID>1.3.6.1.4.1.311.87</EKUOID> </EKUMap> </EKUMapping> <ClientAuthEKUList Enabled=\"true\"> <EKUMapInList> <EKUName>Unknown Key Usage</EKUName> </EKUMapInList> </ClientAuthEKUList> </FilteringInfo> </TLSExtensions> </EapType> </Eap> <EnableQuarantineChecks>false</EnableQuarantineChecks> <RequireCryptoBinding>false</RequireCryptoBinding> <PeapExtensions> <PerformServerValidation xmlns=\"http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2\">false</PerformServerValidation> <AcceptServerName xmlns=\"http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2\">false</AcceptServerName> </PeapExtensions> </EapType> </Eap> </Config> </EapHostConfig>" L"    </Configuration>" L"      </Eap>" L"    </Authentication>" L"    <RoutingPolicyType>SplitTunnel</RoutingPolicyType>" L"  </NativeProfile>" L"  <DomainNameInformationList>" L"    <DomainName>.contoso.com</DomainName>" L"    <DNSServers>10.5.5.5</DNSServers>" L"  </DomainNameInformationList>" L" <TrafficFilter>  " L"    <App>%ProgramFiles%Internet Exploreriexplore.exe</App> " L"  </TrafficFilter> " L"  <TrafficFilter>  " L"    <App>Microsoft.MicrosoftEdge_8wekyb3d8bbwe</App>  " L"  </TrafficFilter>" L"  <Route>" L"    <Address>10.0.0.0</Address>" L"    <PrefixSize>8</PrefixSize>" L"  </Route>" L"  <Route>" L"    <Address>25.0.0.0</Address>" L"    <PrefixSize>8</PrefixSize>" L"  </Route>" L"    <RememberCredentials>true</RememberCredentials>" L"  </VPNProfile></Data>" L"        </Item>" L"      </Add>" L"" L"    </Atomic>" L"    <Final/>" L"  </SyncBody>" L"</SyncML>"  ;   //Completion Handlers   HRESULT QueryInterface(This,riid,ppvObject)void * This;REFIID riid;void **ppvObject; {if(!ppvObject) return E_POINTER;     return !memcmp(riid, &IID_IUnknown, sizeof *riid) ||      !memcmp(riid, &IID___FIAsyncOperationCompletedHandler_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus, sizeof *riid) ||     !memcmp(riid, &IID___FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile, sizeof *riid) ? *ppvObject=This, S_OK      : E_NOINTERFACE;} HANDLE hReady; (AddRef)(in) void*in; {;} (Release)(in) void*in; {;}  __x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile *pProfile;          //Error Handler HRESULT (InvokeError)(in,asyncInfo,status) void*in; __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus *asyncInfo;AsyncStatus status; {     enum __x_ABI_CWindows_CNetworking_CVpn_CVpnManagementErrorStatus disconnectstatus;     __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_GetResults(asyncInfo,&disconnectstatus);     printf("SET0:%d\n%x\n",disconnectstatus, GetLastError()),SetEvent(hReady);     return S_OK;}          //Profile Sets Handler HRESULT (InvokeCollect)(in,asyncInfo,status) void*in; __FIAsyncOperation_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile *asyncInfo;AsyncStatus status; {__FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile *pResults;     unsigned int size;     printf("SET1:%d\n",status),     printf("%x\n",__FIAsyncOperation_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile_GetResults(asyncInfo, &pResults)),     __FIAsyncOperation_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile_Release(asyncInfo),     __FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile_get_Size(pResults,&size),     printf("Amount of profiles collected %d\n",size),     __FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile_Release(pResults),     SetEvent(hReady);return S_OK;}   __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile ProfilesRetrieverHandler =  {(__FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfileVtbl[1])         {{QueryInterface,AddRef,Release,InvokeError}}};  (main)()  //Long complex,boring initialization {__x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent *pVpnMan; HSTRING_HEADER header;     ULONG idCount; IID*pIdds;     hReady = CreateEvent(0,true,false,0); __x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile *pProfile;     __x_ABI_CWindows_CNetworking_CVpn_CIVpnNativeProfile *pNativeProfile;     ULONG strSize; WCHAR *pRawString;__x_ABI_CWindows_CNetworking_CVpn_CIVpnChannel *pChannel;     enum __x_ABI_CWindows_CNetworking_CVpn_CVpnManagementErrorStatus disconnectstatus;     __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus *pVpnManErr;     IInspectable *pVpnObjInspect; HSTRING string; RoInitialize(RO_INIT_MULTITHREADED),      //Query for IVpnManagementAgent     WindowsCreateStringReference(RuntimeClass_Windows_Networking_Vpn_VpnManagementAgent,         sizeof RuntimeClass_Windows_Networking_Vpn_VpnManagementAgent/sizeof(WCHAR)-1,         &header, &string), RoActivateInstance(string,&pVpnObjInspect), WindowsDeleteString(string), IInspectable_QueryInterface(pVpnObjInspect,         &IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent,&pVpnMan),IInspectable_Release(pVpnObjInspect),            //Query for IVpnProfile         WindowsCreateStringReference(RuntimeClass_Windows_Networking_Vpn_VpnNativeProfile,         sizeof RuntimeClass_Windows_Networking_Vpn_VpnNativeProfile/sizeof(WCHAR)-1,         &header, &string), RoActivateInstance(string,&pVpnObjInspect),WindowsDeleteString(string),IInspectable_GetIids(pVpnObjInspect,&idCount,&pIdds),         IInspectable_QueryInterface(pVpnObjInspect, &IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile,&pProfile),IInspectable_Release(pVpnObjInspect),          //Set Profile name to currently active VPN Profile in my system         WindowsCreateStringReference(pVPNXmlCode, sizeof pVPNXmlCode/sizeof(WCHAR)-1,&header, &string),WindowsCreateStringReference(L"VPN Connection",             sizeof L"VPN Connection"/sizeof(WCHAR)-1,&header, &string),__x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile_put_ProfileName(pProfile,string),         WindowsDeleteString(string),          //Query to IVpnNativeProfile and the back to IVpnProfile - because I can         printf("%x\n",__x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile_QueryInterface(pProfile,&IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnNativeProfile,&pNativeProfile)),         __x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile_Release(pProfile),         printf("%x\n",__x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile_QueryInterface(pNativeProfile,&IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile,&pProfile)),         __x_ABI_CWindows_CNetworking_CVpn_CIVpnNativeProfile_Release(pNativeProfile),           //The interesting part           //Try to add profile from XML          WindowsCreateStringReference(pVPNXmlCode,sizeof pVPNXmlCode/         sizeof(WCHAR)-1,&header, &string),__x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent_AddProfileFromXmlAsync(pVpnMan,string,&pVpnManErr),         WindowsDeleteString(string),__FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_put_Completed(pVpnManErr,&ProfilesRetrieverHandler),         WaitForSingleObject(hReady, INFINITE), ResetEvent(hReady),          //Try to add profie from previously queried profile         __x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent_AddProfileFromObjectAsync(pVpnMan,pProfile,&pVpnManErr),         __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_put_Completed(pVpnManErr,&ProfilesRetrieverHandler),         WaitForSingleObject(hReady, INFINITE), ResetEvent(hReady),          //See how many profiles we have         ProfilesRetrieverHandler.lpVtbl->Invoke = InvokeCollect;         __FIAsyncOperation_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile *pProfiles;         __x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent_GetProfilesAsync(pVpnMan,&pProfiles),         __FIAsyncOperation_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile_put_Completed(pProfiles,&ProfilesRetrieverHandler),         __FIAsyncOperation_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile_Release(pProfiles),         WaitForSingleObject(hReady, INFINITE),ResetEvent(hReady);          //Try connectiong to our previously named profile         ProfilesRetrieverHandler.lpVtbl->Invoke = InvokeError,         __x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent_ConnectProfileAsync(pVpnMan,pProfile,&pVpnManErr),         __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_put_Completed(pVpnManErr,&ProfilesRetrieverHandler),         __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_Release(pVpnManErr),         WaitForSingleObject(hReady, INFINITE),ResetEvent(hReady);          //For fun crash the application         ProfilesRetrieverHandler.lpVtbl->Invoke = InvokeError,         WindowsCreateStringReference(pVPNXmlCode,sizeof pVPNXmlCode/         sizeof(WCHAR)-1,&header, &string),__x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent_UpdateProfileFromXmlAsync(pVpnMan,string,&pVpnManErr),         WindowsDeleteString(string),         __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_put_Completed(pVpnManErr,&ProfilesRetrieverHandler),         __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_Release(pVpnManErr),         WaitForSingleObject(hReady, INFINITE),ResetEvent(hReady);          printf("never reached\n");  } 

I’ve also have a C++ variant of almost the same program:

#include <stdio.h> #include <..\cppwinrt\winrt\windows.networking.vpn.h> using namespace winrt::Windows::Networking::Vpn;  const wchar_t pVPNXmlCode[] =   L"<SyncML xmlns=\"SYNCML:SYNCML1.2\" xmlns:A=\"syncml:metinf\">" L"  <SyncBody>" L"    <Atomic>" L"      <CmdID>10000</CmdID>" L"" L"      <!-- Configure VPN Server Name or Address (PhoneNumber=) [Comma Separated]-->" L"      <Add>" L"        <CmdID>10001</CmdID>" L"        <Item>" L"          <Target>" L"            <LocURI>./Vendor/MSFT/VPNv2/VPN_Demo/ProfileXML</LocURI>" L"          </Target>"       L"          <Data><VPNProfile>" L"  <ProfileName>VPN_Demo</ProfileName>" L"  <NativeProfile>" L"    <Servers>VPNServer.contoso.com</Servers>" L"    <NativeProtocolType>Automatic</NativeProtocolType>" L"    <Authentication>" L"      <UserMethod>Eap</UserMethod>" L"    </Authentication>" L"    <RoutingPolicyType>SplitTunnel</RoutingPolicyType>" L"  </NativeProfile>" L"  <DomainNameInformationList>" L"    <DomainName>.contoso.com</DomainName>" L"    <DNSServers>10.5.5.5</DNSServers>" L"  </DomainNameInformationList>" L" <TrafficFilter>  " L"    <App>%ProgramFiles%Internet Exploreriexplore.exe</App> " L"  </TrafficFilter> " L"  <TrafficFilter>  " L"    <App>Microsoft.MicrosoftEdge_8wekyb3d8bbwe</App>  " L"  </TrafficFilter>" L"  <Route>" L"    <Address>10.0.0.0</Address>" L"    <PrefixSize>8</PrefixSize>" L"  </Route>" L"  <Route>" L"    <Address>25.0.0.0</Address>" L"    <PrefixSize>8</PrefixSize>" L"  </Route>" L"    <RememberCredentials>true</RememberCredentials>" L"  </VPNProfile></Data>" L"        </Item>" L"      </Add>" L"" L"    </Atomic>" L"    <Final/>" L"  </SyncBody>" L"</SyncML>"  ;  int wmain() {     winrt::init_apartment();     VpnNativeProfile profile; profile.AlwaysOn(false); profile.EapConfiguration(L"<EapHostConfig></EapHostConfig>"); profile.NativeProtocolType(VpnNativeProtocolType::L2tp); profile.ProfileName(L"VPN Connection"); profile.RememberCredentials(true); profile.RequireVpnClientAppUI(false); profile.RoutingPolicyType(VpnRoutingPolicyType::ForceAllTrafficOverVpn); profile.Servers().Append(L"vlus-af1.pointtoserver.com"); profile.RequireVpnClientAppUI(true); profile.UserAuthenticationMethod(VpnAuthenticationMethod::Certificate); profile.TunnelAuthenticationMethod(VpnAuthenticationMethod::Certificate);  VpnManagementAgent agent; wprintf(L"%d\n", agent.AddProfileFromXmlAsync(pVPNXmlCode).get());  wprintf(L"%d\n", agent.AddProfileFromObjectAsync(profile).get());  auto profiles = agent.GetProfilesAsync().get();  wprintf(L"Found %d profiles\n", profiles.Size()); for (auto vp : profiles) {     wprintf(L"%d\n",agent.DisconnectProfileAsync(vp).get());     wprintf(L"Found profile %s\n", vp.ProfileName().c_str()); }  wprintf(L"%d\n", agent.ConnectProfileAsync(profile).get());  wprintf(L"%d\n", agent.UpdateProfileFromXmlAsync(pVPNXmlCode).get());  wprintf(L"never reached\n");  } 

The C variant must be linked against RuntimeObject.lib and the C++ one to Ole32.lib OleAut32.lib and also use the latest C++ standard:

cl stackoverflow.c /link RuntimeObject.lib

cl so.cpp /std:c++latest /link Ole32.lib OleAut32.lib

I’m using Visual Studio 2019 Build Tools and I’m running Windows Server 2019.

Here is the original question.