I read all of Microsoft’s documentation but their claim is that it should work without any additional libs. An hour of Googling yielded no results. My code:
#include <windows.h>
#include <ras.h>
int main()
{
char* szPhoneNumberToDial = "127.0.0.1";
char* szUserName = "test";
char* szPassword = "test";
RASDIALPARAMS rdParams;
rdParams.dwSize = sizeof(RASDIALPARAMS);
rdParams.szEntryName[0] = '\0';
lstrcpy(rdParams.szPhoneNumber, szPhoneNumberToDial);
rdParams.szCallbackNumber[0] = '\0';
lstrcpy( rdParams.szUserName, szUserName );
lstrcpy( rdParams.szPassword, szPassword );
rdParams.szDomain[0] = '\0';
HRASCONN hRasConn = NULL;
DWORD dwRet = RasDial(NULL, NULL, &rdParams, 0L, NULL, &hRasConn);
}
Error:
undefined reference to 'RasDialA@24'
I tried both a C and C++ implementation (in both VC++ 2010 and MinGW/gcc & g++) but they both resulted in this same error.
Any ideas?
according documentation, the requirements toRasDial()usage, alsoRas.hheader, is the
Rasapi32.liblibrary. If this is avaliable on your compiler, pass it to link by using-loption ongcc:
EDIT: Thanks to @Mark Wilkins, that has provided the command-line for
Microsoft Compiler: