'PIP_ADAPTER_ADDRESSES' was not declared in this scope

Joined
Aug 7, 2010
Messages
1
Reaction score
0
Hi,

I am trying to use the GetAdaptersAddresses() function but I keep getting the above error. From what I understand, I have to link the iphlpapi.lib and the WS2_32.Lib which i get from the Windows SDK. However, I just fail to compile a simple program like below:

Code:
#include <iostream>
#include <winsock2.h>
#include <iphlpapi.h>
#define WORKING_BUFFER_SIZE 15000

using namespace std;

int main( int argc, char** argv) {
    PIP_ADAPTER_ADDRESSES pAddresses = new IP_ADAPTER_ADDRESSES[WORKING_BUFFER_SIZE];
    ULONG outBufLen = WORKING_BUFFER_SIZE;
    GetAdaptersAddresses( AF_UNSPEC, 0, NULL,  pAddresses, &outBufLen);
    return 0;
}

I am using Code::Blocks mingw g++ compiler.

Can anyone assist me with this??
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top