Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem with header file -MAC Address

Problem with header file -MAC Address

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    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

    A 1 Reply Last reply
    0
    • L Lost User

      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

      A Offline
      A Offline
      Antony M Kancidrowski
      wrote on last edited by
      #2

      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)

      U 1 Reply Last reply
      0
      • A Antony M Kancidrowski

        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)

        U Offline
        U Offline
        User 1149186
        wrote on last edited by
        #3

        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

        A 1 Reply Last reply
        0
        • U User 1149186

          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

          A Offline
          A Offline
          Antony M Kancidrowski
          wrote on last edited by
          #4

          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)

          U 1 Reply Last reply
          0
          • A Antony M Kancidrowski

            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)

            U Offline
            U Offline
            User 1149186
            wrote on last edited by
            #5

            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

            U D 2 Replies Last reply
            0
            • U User 1149186

              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

              U Offline
              U Offline
              User 1149186
              wrote on last edited by
              #6

              Antony, The file is missing in VC 6.0 . Whereas the same program runs very well in Visual Studio.net Thanks Antony Bye

              1 Reply Last reply
              0
              • U User 1149186

                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

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups