Menu

How to use GetAdaptersAddresses in DevC++?

StephenNY
2010-04-02
2012-09-26
  • StephenNY

    StephenNY - 2010-04-02

    Hi Everyone

    I'm trying to use GetAdaptersAddresses function in DevC++.
    From the MSDN website it seems i'm supposed to include these as the header.

    include <iphlpapi.h>

    pragma comment(lib, "IPHLPAPI.lib")

    I have a question about IPHLPAPI.lib

    I notice "libiphlpapi.a" in Dev's lib folder.

    Isn't there some software that I'm supposed to use to convert this into an
    .lib file for use in my program?

    Thanks

    Stephen

     
  • cpns

    cpns - 2010-04-02

    All #pragma directives are compiler specific, so the one in your example will
    not work with GCC. The required bahaviur of a compiler when faced with an
    unrecognised #pragma is simply to ignore it.

    Microsoft's naming convention for libraries differs from GCC; so when MSDN
    required XXX.lib, in GCC you use libXXX.a so the library you mentioned is
    indeed the correct one.

    What you need to do is #include the header and link the library. In GCC a
    library in a standard path (i.e. specified on the command line by a -L
    option) can be linked by adding -l<lib> to the project linker options. Note
    that for a library libXXX.a, the correct option is -lXXX. The lib prefix and
    .a extension are implicit. So in your case you need -liphlpap. Note also that
    that is -l (lowercase-L), not teh number one or capltal-i for example.

    I believe also that linking libraries is discussed in the "PLEASE READ
    BEFORE POSTING A QUESTION
    "
    thread.

     
  • laxman varada

    laxman varada - 2010-08-16

    hi,

    Isn't there some software that I'm supposed to use to convert this into an
    .lib file for use in my program

    regards,
    phe9oxis,
    http://www.guidebuddha.com

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.