compilation fails with Win32 API call

Andrew Schulman
Tue Sep 20 15:35:00 GMT 2011

I'm trying to compile a program that calls the win32 function
SetThreadExecutionState, in kernel32.dll [1].  The link step fails:

$ gcc -c nosleep.c
$ gcc -o nosleep nosleep.o -lkernel32
nosleep.o:nosleep.c:(.text+0x1f): undefined reference to
nosleep.o:nosleep.c:(.text+0x5c): undefined reference to
collect2: ld returned 1 exit status

According to the FAQ [2], I shouldn't even have to include -lkernel32.

Can someone please tell me what I'm doing wrong?



Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list