| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-Spam-Check-By: | sourceware.org |
| Date: | Fri, 25 Sep 2009 13:34:56 -0400 |
| From: | Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Unresolved Reference when Linking a C program with GetUserNameEX() |
| Message-ID: | <20090925173456.GA26892@ednor.casa.cgf.cx> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| References: | <6f7465110909250900l49bd8cebsbd43417b3a1df04c AT mail DOT gmail DOT com> <6f7465110909250906i5df78351lfaa5e2a9ed4255c AT mail DOT gmail DOT com> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <6f7465110909250906i5df78351lfaa5e2a9ed4255c@mail.gmail.com> |
| User-Agent: | Mutt/1.5.20 (2009-06-14) |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |