Win CE GetIpAddrTable() Linker error

Hi People,

I’m currently developing an Application in Embedded Visual C++ using API not MFC, for a pocket PC which is running Windows CE 3.0.

I’m trying to retrieve the Subnet mask from the pocket PCs network card.

I used the function GetIpAddrTable(), which is OK when I compile, but when I try to build the application I get the following LINKER errors

Creating library MIPSRel/MTool.lib and object MIPSRel/MTool.exp
ScanNetwork.obj : error LNK2019: unresolved external symbol GetIpAddrTable referenced in function "int __cdecl scanNetworkNow(struct HWND__ *,char (* const)[512])" (?scanNetworkNow@@YAHPAUHWND__@@QAY0CAA@D@Z)

MIPSRel/MTool.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

MTool.dll - 2 error(s), 0 warning(s)

I have included the library file iphlpapi.lib in my project setting and have included the iphlpapi.h header file in my source code.

I have listed my source below:

char *  szTotResult;
char data[sizeof(MIB_IPADDRTABLE) + 32 * sizeof(MIB_IPADDRROW)];
ULONG len = sizeof(data);
IN_ADDR  inAddr;
int ind;

// Find all interfaces
if(GetIpAddrTable((PMIB_IPADDRTABLE)data, &len, true ) == NO_ERROR)
             ipAddr = (PMIB_IPADDRTABLE)data;
      for(ind = 0; ind < (int)ipAddr->dwNumEntries; ind++)
            if(ipAddr->table[ind].dwAddr != 0)
                  // combind Addr and Sub net mask
                                      UINT bCast = ipAddr->table [ind].dwAddr  | ~ipAddr-table[ind].dwMask;

            inAddr.S_un.S_addr = bCast;
            szTotResult = inet_ntoa (inAddr);

Can any one help me please ? I have try the same soruce code in Visual C++ and it all works fine.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

When you say:

"I have included the library file iphlpapi.lib in my project setting"

what EXACTLY does that mean?  I think you have NOT included iphlpapi.lib in your LINKER input files.

Go to your PROJECT SETTINGS and the LINK tab there and add "iphlpapi.lib" to the "Object/libary modules" edit box there for ALL of your configurations.
LPlateAuthor Commented:
I have included iphlpapi.lib in my PROJECT SETTINGS -> LINK
For ALL your configurations?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Or, alternatively, specify

#pragma comment ( lib, "iphlpapi.lib")

in one of your header files.
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: jhance {http:#9721786}

Please leave any comments here within the next seven days.

EE Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.