-1

Just what the title indicates:

How can I get the MAC address of the computer where the program runs on with Visual C++ ?

I got:

getManagerHostMAC.obj : error LNK2019: unresolved external symbol _GetAdaptersInfo@8  

with the function provided by: Getting Machine's MAC Address -- Good Solution?

Community
  • 1
  • 1
CDT
  • 10,165
  • 18
  • 66
  • 97
  • 1
    [This](http://www.codeguru.com/cpp/i-n/network/networkinformation/article.php/c5451/Three-ways-to-get-your-MAC-address.htm) is pretty old but may be worth looking @. – ChiefTwoPencils Jun 27 '13 at 09:08

2 Answers2

2

The Win32 GetAdaptersInfo() and GetAdaptersAddresses() functions both return MAC addresses, amongst other things. Remember that a machine may have multiple network adapters installed, thus have multiple MAC addresses available.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
1

You need to link with Iphlpapi.lib. In Visual Studio, just add it to the list of linker libraries in the Project Properties dialog.

selbie
  • 100,020
  • 15
  • 103
  • 173