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

Posted on 2006-04-15
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 "" 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
    LVL 12

    Accepted Solution

    In VC++ this function is in library

    Try using this library also and see

    Expert Comment

    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

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Preface In the first article: A Better Website Login System ( I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
    What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
    Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now