This is the mail archive of the
cygwin-xfree
mailing list for the Cygwin XFree86 project.
Build with MinGW GCC, link to Cygwin libs, program doesn't work
- From: Daniel Orzechowski <DANIEL dot E dot ORZECHOWSKI at saic dot com>
- To: cygwin-xfree at cygwin dot com
- Date: Mon, 12 Sep 2005 17:20:13 -0400
- Subject: Build with MinGW GCC, link to Cygwin libs, program doesn't work
- Reply-to: cygwin-xfree at cygwin dot com
I've built a simple application by compiling the source with the MinGW
version of GCC 3.3.1 , and linking to the regular Cygwin X11 libraries.
---
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
int main(int argc, char *argv[])
{
Display *display;
printf("hello world\n");
display = XOpenDisplay(":0.0");
printf("ok\n");
if (display == NULL)
{
fprintf(stderr, "can't connect to X server\n");
exit(1);
}
printf("connected ok\n");
XCloseDisplay(display);
exit(0);
}
---
My C_INCLUDE_PATH environment variable points to the
c:\cygwin\usr\X11R6\include , and my LIBRARY_PATH variable points to
c:\cygwin\usr\X11R6\lib .
After calling
> gcc -o test test.c -lX11-6
the code compiles and links successfully. I run XWin.exe (which works
properly; I am able to use xeyes, xfontsel, etc.) and then launch my
program. It gets stuck on the call to XOpenDisplay(), and does nothing but
run the CPU up to 99% load until I send it a Ctrl-C.
I'm not very familiar with Cygwin, and wouldn't know where to start looking
to troubleshoot this. Has anyone ever experienced anything similar to this
problem, or know where I could look to get started? I skimmed the FAQ but
didn't seem to find anything relevant.
Thanks in advance for any help.
- Dan
(Switching compilers or Cygwin versions isn't really possible, since our
customer is dictating what build environment we use. I'm attempting to use
the Cygwin X libraries since we're evaluating alternatives to the
commercial off-the-shelf X server and client software we're currently using.)
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/