Chris LeBlanc wrote: >> gcc-4 test_sleep.c -Wall -lX11 -lcomdlg32 -o test_sleep > In file included from /usr/include/unistd.h:4, > from test_sleep.c:4: > /usr/include/sys/unistd.h:144: error: expected declaration specifiers > or '...' before '(' token > /usr/include/sys/unistd.h:144: error: conflicting types for 'Sleep' > /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../include/w32api/winbase.h:1984: > error: previous declaration of 'Sleep' was here
Argh. Someone somewher has done "#define sleep Sleep" and it's messing over the definition of sleep() in unistd.h making it conflict with Sleep() from winbase.h. No, hang on, it's even worserer than that: # 69 "/usr/include/X11/Xwindows.h" 3 4 #define sleep(x) Sleep((x) * 1000) ... leading to this nonsensical declaration: unsigned __attribute__((__cdecl__)) Sleep((unsigned int __seconds) * 1000); Ok, so you can work around that with careful ordering, as long as you don't want the unistd version of sleep. Try it like this: ad...@ubik /tmp/x $ cat test-x.c #include <stdio.h> #include <unistd.h> #include <X11/Xwindows.h> #include <windows.h> int main() { printf("Hello\n"); return 0; } ad...@ubik /tmp/x $ gcc-4 test-x.c -Wall -lX11 -lcomdlg32 -o test-x.exe --save-temps ad...@ubik /tmp/x $ ./test-x.exe Hello ad...@ubik /tmp/x $ cheers, DaveK -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/