Solved

Win CE GetIpAddrTable() Linker error

Posted on 2003-11-11
6
1,089 Views
Last Modified: 2007-12-19
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

Linking...
   
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;
PMIB_IPADDRTABLE ipAddr;
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.

0
Comment
Question by:LPlate
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 9721650
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.
0
 

Author Comment

by:LPlate
ID: 9721784
I have included iphlpapi.lib in my PROJECT SETTINGS -> LINK
0
 
LVL 32

Accepted Solution

by:
jhance earned 250 total points
ID: 9721786
For ALL your configurations?
0
 
LVL 86

Expert Comment

by:jkr
ID: 9722121
Or, alternatively, specify

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

in one of your header files.
0
 
LVL 9

Expert Comment

by:tinchos
ID: 10248955
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.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

730 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