I can't to compile my code.
it is an error://
Del_MFC_APIView.obj : error LNK2001: unresolved external symbol __imp__RpcStringFreeA@4
Del_MFC_APIView.obj : error LNK2001: unresolved external symbol __imp__UuidToStringA@8
Del_MFC_APIView.obj : error LNK2001: unresolved external symbol __imp__UuidCreate@4
Debug/Del_MFC_API.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
Creating browse info file...
Del_MFC_API.exe - 4 error(s), 0 warning(s)//
why this happend
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
BOOL GetNicAddress(LPSTR pszNicAddress, UINT nBufSize);
int main(int argc, char* argv[])
{
UINT buffer=0;
BOOL success=GetNicAddress("eitan",buffer);
return 0;
}
BOOL GetNicAddress(LPSTR pszNicAddress, UINT nBufSize)
{
BOOL bSuccess = FALSE;
//NIC address is 12 character string
if (nBufSize < 13)
return FALSE;
//the way we determine the NIC address is to call the RPC DCE function
//UuidCreate. The standard format of the GUID returned contains
//the NIC address in the last 12 characters. The added advantage to
//this method is that we do not need to rely on a specific network
//protocol needing to be installed on the client machine to determine
//the NIC address. You could use this function as the basis for a
//security scheme for a networked product of yours. Using the NIC address
//is a guranteed way of uniquely identify a machine throughout the network.
UUID Uuid;
RPC_STATUS rpcStatus = UuidCreate(&Uuid);
if (rpcStatus == RPC_S_OK)
{
unsigned char* pszGuid;
rpcStatus = UuidToString(&Uuid, &pszGuid);
if (rpcStatus == RPC_S_OK)
{
char* pLastMinus = strrchr((char*)pszGuid, '-');
if (pLastMinus)
{
strcpy(pszNicAddress, pLastMinus+1);
bSuccess = TRUE;
}
//need to free created buffer
RpcStringFree(&pszGuid);
}
else
printf("Error calling UuidToString, Error value is %d\n", rpcStatus);
}
else
printf("Error calling UuidCreate, Error value is %d\n", rpcStatus);
return bSuccess;
}