This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unresolved Reference when Linking a C program with GetUserNameEX()


On Fri, Sep 25, 2009 at 11:06:56AM -0500, Paul Lupa wrote:
>Hi,
>
>The following code does not link because of an undefinded reference.
>
>#include <sys/utsname.h>
>#include <unistd.h>
>#include <stdio.h>
>#include <stdlib.h>
>#include <windows.h>
>
>main()
>? {
>? char? data[500];
>? DWORD?? data_len;
>? GetComputerNameEx( 1, data, &data_len);
>
>? printf("%s\n", data );
>? }
>
>
>The routine "GetComputerName()" is available, but not the extended version.
>
>Is there a list of what functions are available from? the kernel32.lib? ?
>
>I am compiling it with the following line:
>
>?? gcc?? test.c -o test
>
>?? Should I be using a different compile line???? I can use the
>GetComputerName() function.

Given the windows function you're trying to use, it sounds like you'd be happier
with mingw - http://mingw.org/.  The reason for this project is to avoid the need
to call functions like GetComputerNameEx in favor of linux-like calls.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]