undefined reference to `GetAdaptersInfo@8' but IPHlpApi.Lib is included

Posted on 2006-04-15
Medium Priority
Last Modified: 2013-11-18

I'm trying to compile a program that uses GetAdaptersInfo().
So I added IPHlpApi.Lib to my devcpp project.

The compilation command looks like this:
make.exe -f "Makefile.win" all
g++.exe main.o lan.o nic.o socket.o icmp.o  -o "beta.exe" -L"C:/Dev-Cpp/lib" "path/to/Microsoft Platform SDK for Windows Server 2003 R2/Lib/Ws2_32.lib" "path/to/Microsoft Platform SDK for Windows Server 2003 R2/Lib/IPHlpApi.Lib"

but i get this error messages:
nic.o(.text+0x2b):nic.cpp: undefined reference to `GetAdaptersInfo@8'
icmp.o(.text+0x7):icmp.cpp: undefined reference to `IcmpCreateFile@0'
icmp.o(.text+0x5a):icmp.cpp: undefined reference to `IcmpSendEcho@32'

I don't know why. ws2_32.lib is linked fine (I do not get an error like "[Linker error] undefined reference to `inet_addr@4'") but not IPHlpApi.lib.
The file IPHlpApi.lib exists...

Has anybody an idea?

Question by:ManuelSchoelling
  • 2
LVL 12

Accepted Solution

rajeev_devin earned 800 total points
ID: 16468614
In VC++ this function is in library

Try using this library also and see

Expert Comment

ID: 20353706
Solution indicated doesn't work.  When this library is added to the project the program won't compile.  BCB 6.0 generates a linker error that complaines about the library.

[Linker Error] 'C:\PROGRAM FILES\MICROSOFT PLATFORM SDK FOR WINDOWS XP SP2\LIB\IPHLPAPI.LIB' contains invalid OMF record, type 0x21 (possibly COFF)

Expert Comment

ID: 20353771
I found that Borland has its own versions of some libraries which includes iphlpapi.lib.  They are loaced in C:\Program Files\Borland\CBuilder6\Lib\Psdk.


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question