Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » Linker error (Mingw)
Linker error (Mingw) [message #10877] Thu, 02 August 2007 08:01 Go to next message
zaurus is currently offline  zaurus
Messages: 42
Registered: May 2006
Member
I'm trying to use some windows function to get the MAC address of the network card. But I always get an error during linking. The function GetAdaptersInfo is defined in iphlpapi.h. I also can find a libiphlpapi.a in C:\upp\mingw\lib.

This is the source.

#include <winsock2.h>
#include <iphlpapi.h>
#include <assert.h>
#include "stdio.h"

int main(int argc, const char *argv[])
{
	IP_ADAPTER_INFO AdapterInfo[2];
  	DWORD dwBufLen = sizeof(AdapterInfo);
  	DWORD dwStatus = GetAdaptersInfo(AdapterInfo, &dwBufLen);
  	assert(dwStatus == ERROR_SUCCESS);
  	PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
	return 0;
}


And this the error.

Linking...
(option '-O 2' ignored)
___main: duplicate
-> used: libmingw32.a:gccmain.o:1
-> discarded: libgcc.a:__main.o:1
1 undefined symbol(s):
_GetAdaptersInfo@8 (referenced from c:\upp\out\macadr\mingw.debug_full.main\macadr.o:1; _main; .text)
linking aborted due to fatal errors
collect2: ld returned 1 exit status


Did I miss out something or is this an issue of mingw? Anybody had a similar problem and found the solution?

Thanks for any help.
Re: Linker error (Mingw) [message #10879 is a reply to message #10877] Thu, 02 August 2007 11:38 Go to previous message
zaurus is currently offline  zaurus
Messages: 42
Registered: May 2006
Member
I found a solution.

If I add 'libiphlpapi.a' in the 'Package Organizer' as a new library, then I can link the program without problems.

Still I don't understand it as 'libiphlpapi.a' is located in c:\upp\mingw\lib and should be automatically available for the linker.

Anybody has an explanation for this?

To solve a problem is good, but it's even better to understand the solution.
Previous Topic: Static linking to my custom lib on Linux -- is there a better solution?
Next Topic: What compiler are you using with Ultimate++?
Goto Forum:
  


Current Time: Fri Apr 26 09:40:47 CEST 2024

Total time taken to generate the page: 0.04973 seconds