delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <4E785F01.9050909@users.sourceforge.net> |
Date: | Tue, 20 Sep 2011 17:38:09 +0800 |
From: | JonY <jon_y AT users DOT sourceforge DOT net> |
User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.0 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: compilation fails with Win32 API call |
References: | <bilg77dmpjm2d0bcu3tiqcl2i4cau04lqo AT 4ax DOT com> |
In-Reply-To: | <bilg77dmpjm2d0bcu3tiqcl2i4cau04lqo@4ax.com> |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.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 |
--------------enig38EF64AC8ABDF0619F201A25 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 9/20/2011 17:12, Andrew Schulman wrote: > I'm trying to compile a program that calls the win32 function > SetThreadExecutionState, in kernel32.dll [1]. The link step fails: >=20 > $ gcc -c nosleep.c > $ gcc -o nosleep nosleep.o -lkernel32 > nosleep.o:nosleep.c:(.text+0x1f): undefined reference to > `_SetThreadExecutionState' > nosleep.o:nosleep.c:(.text+0x5c): undefined reference to > `_SetThreadExecutionState' > collect2: ld returned 1 exit status >=20 > According to the FAQ [2], I shouldn't even have to include -lkernel32. >=20 > Can someone please tell me what I'm doing wrong? >=20 > Thanks, > Andrew. >=20 > [1] http://msdn.microsoft.com/en-us/library/aa373208(VS.85).aspx > [2] > http://www.cygwin.com/faq/faq.programming.html#faq.programming.win32-api >=20 >=20 Hi, There are a few possible causes. 1) You didn't include windows.h 2) You included it but didn't bump _WIN32_WINNT or equivalent. 3) The declaration is missing from winbase.h --------------enig38EF64AC8ABDF0619F201A25 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (MingW32) iEYEARECAAYFAk54XwEACgkQp56AKe10wHcQ1wCgiUhvfHN/2+moBxAjb1c1AbTX jW8Ani7AvvgEmohWX04xJh+px+XMIIp4 =NzYk -----END PGP SIGNATURE----- --------------enig38EF64AC8ABDF0619F201A25--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |