X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=2.0 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 Date: Tue, 5 May 2009 14:57:47 +1200 Message-ID: Subject: problems using Xlib.h/Xwindows.h/unistd.h and win32api under gcc-4 From: Chris LeBlanc To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hi, I'm trying to migrate our commercial software (we've purchased a commercial Cygwin license) thats been running well on Cygwin using gcc 3.x to gcc-4. Its mature Unix/Linux C and Fortran code. We're using the win32api so we can use native Windows file dialogs. This has been working in gcc 3.4, but now raises an error with gcc 4.3.2 (updated Cygwin yesterday). I've narrowed this down with a bit of example code: #include /* The next two includes have conflicts: */ #include #include /* so do these two: */ //#include #include int main() { printf("Hello\n"); return 0; } This ultra-simple program includes , (win32api), and unistd.h. I gave gcc-4 the flags -lX11 for X11 libraries, and -lcomdlg32 for the Windows dialog libraries. Here is the error I see: > gcc-4 test_sleep.c -Wall -lX11 -lcomdlg32 -o test_sleep In file included from /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../include/w32api/windows.h:87, from test_sleep.c:5: /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../include/w32api/winspool.h:255: error: two or more data types in declaration specifiers /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../include/w32api/winspool.h:270: error: two or more data types in declaration specifiers /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../include/w32api/winspool.h:291: error: two or more data types in declaration specifiers /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../include/w32api/winspool.h:316: error: two or more data types in declaration specifiers /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../include/w32api/winspool.h:571: error: two or more data types in declaration specifiers /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../include/w32api/winspool.h:594: error: two or more data types in declaration specifiers I noticed this post: http://sourceware.org/ml/cygwin/2009-03/msg00420.html, so tried replacing with . This now raises a different error, this time conflicting with unistd.h. If we also comment out the include for windows.h, we still get the same error: > 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 So in summary, X11/Xlib.h conflicts with windows.h, and X11/Xwindow.h conflicts with unistd.h. Any suggestions on how to get around this (unfortunately I need unistd.h, windows.h, and either Xlib.h or Xwindows.h)? The fact that Xwindows.h conflicts with unistd.h (a common scenario) suggests a bug in Xwindows.h, unfortunately I'm not sure how to fix the problem. Cheers, Chris -- Chris LeBlanc Claritas Development GNS Science Lower Hutt, New Zealand Web: www.globeclaritas.com -- 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/