[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Win CE GetIpAddrTable() Linker error

Posted on 2003-11-11
6
Medium Priority
?
1,123 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
5 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 1000 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

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Suggested Courses

829 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