Problem with header file -MAC Address
-
Hi, I included this file in my source code and depsite this it throws error. I am ruunng on Windows 2000 PROFESSIONAL. Looks strange. Psl helpme out.This is the source code available from MSDN. //#include "windows.h" header file" #include //#include "stdio.h" header file #include //#include "tchar.h" header file #include //#include "iphlpapi.h" header file #include int main() { HRESULT hr; IPAddr ipAddr; ULONG pulMac[2]; ULONG ulLen; ipAddr = inet_addr ("192.168.25.31"); memset (pulMac, 0xff, sizeof (pulMac)); ulLen = 6; hr = SendARP (ipAddr, 0, pulMac, &ulLen); printf ("Return %08x, length %8d\n", hr, ulLen); size_t i, j; char * szMac = new char[ulLen*3]; PBYTE pbHexMac = (PBYTE) pulMac; // // Convert the binary MAC address into human-readable // for (i = 0, j = 0; i < ulLen - 1; ++i) { j += sprintf (szMac + j, "%02X:", pbHexMac[i]); } sprintf (szMac + j, "%02X", pbHexMac[i]); printf ("MAC address %s\n", szMac); delete [] szMac; return 0; } after compiling: Error:d:\kuttanur\macaddress\mac.cpp(5) : fatal error C1083: Cannot open include file: 'iphlpapi.h': No such file or directory Regards
-
Hi, I included this file in my source code and depsite this it throws error. I am ruunng on Windows 2000 PROFESSIONAL. Looks strange. Psl helpme out.This is the source code available from MSDN. //#include "windows.h" header file" #include //#include "stdio.h" header file #include //#include "tchar.h" header file #include //#include "iphlpapi.h" header file #include int main() { HRESULT hr; IPAddr ipAddr; ULONG pulMac[2]; ULONG ulLen; ipAddr = inet_addr ("192.168.25.31"); memset (pulMac, 0xff, sizeof (pulMac)); ulLen = 6; hr = SendARP (ipAddr, 0, pulMac, &ulLen); printf ("Return %08x, length %8d\n", hr, ulLen); size_t i, j; char * szMac = new char[ulLen*3]; PBYTE pbHexMac = (PBYTE) pulMac; // // Convert the binary MAC address into human-readable // for (i = 0, j = 0; i < ulLen - 1; ++i) { j += sprintf (szMac + j, "%02X:", pbHexMac[i]); } sprintf (szMac + j, "%02X", pbHexMac[i]); printf ("MAC address %s\n", szMac); delete [] szMac; return 0; } after compiling: Error:d:\kuttanur\macaddress\mac.cpp(5) : fatal error C1083: Cannot open include file: 'iphlpapi.h': No such file or directory Regards
Have you installed the Platform SDK? If not then I recommend you install it. If you have ensure that the appropriate path is in you include directory list. i.e. <platform sdk directory>\include Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fuity and sweet.
I'm jelly, what am I? - David Williams (Little Britain) -
Have you installed the Platform SDK? If not then I recommend you install it. If you have ensure that the appropriate path is in you include directory list. i.e. <platform sdk directory>\include Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fuity and sweet.
I'm jelly, what am I? - David Williams (Little Britain)Ya ANTONY ,Its already installed. I have run many window programs even getting the list of network resourcesWhen I wrote a smll program in Win32. All r running well excep this. Can somebody help me out. Regards BlackTiger BlackTiger007
-
Ya ANTONY ,Its already installed. I have run many window programs even getting the list of network resourcesWhen I wrote a smll program in Win32. All r running well excep this. Can somebody help me out. Regards BlackTiger BlackTiger007
If you search for iphlpapi.h on your system is it in a directory that is in your include list? Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fuity and sweet.
I'm jelly, what am I? - David Williams (Little Britain) -
If you search for iphlpapi.h on your system is it in a directory that is in your include list? Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fuity and sweet.
I'm jelly, what am I? - David Williams (Little Britain)Antony, When I searched the file I found it 2 locations 1. C:\Program Files\Platform SDK\Include 2. C:\Program Files\Microsodt Visual Studio.net 2003\Vc7\PlatformSDK\Include But I am running this application using VC 6.0. Regards BlackTiger007 BlackTiger007
-
Antony, When I searched the file I found it 2 locations 1. C:\Program Files\Platform SDK\Include 2. C:\Program Files\Microsodt Visual Studio.net 2003\Vc7\PlatformSDK\Include But I am running this application using VC 6.0. Regards BlackTiger007 BlackTiger007
Antony, The file is missing in VC 6.0 . Whereas the same program runs very well in Visual Studio.net Thanks Antony Bye
-
Antony, When I searched the file I found it 2 locations 1. C:\Program Files\Platform SDK\Include 2. C:\Program Files\Microsodt Visual Studio.net 2003\Vc7\PlatformSDK\Include But I am running this application using VC 6.0. Regards BlackTiger007 BlackTiger007
You need to ensure that C:\Program Files\Platform SDK\Include is being searched. Go to Tools/Options and select the Directories tab. Is C:\Program Files\Platform SDK\Include in the list of Include directories? You can also right click on the
#include <iphlpapi.h>
statement and select Open. If the file does not open, you know that it cannot be found.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen