This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

newbie linking problems


Hi. i'm trying to link a simple program using X11 and a com port. the
include and lib paths seem fine. The problem is with undefined references
during linking:

If in the makefile I link with static libraries (XLIB = ${XPATH}/lib/), I
get lots of X related link errors such as: "xdisplay.c: undefined reference
to '_XOpenDisplay'". If I switch to use dynamic libraries (XLIB =
${XPATH}/bin/), these errors go away. Why is this? On the serial side, I am
getting a undefined reference link error on cfmakeraw() which is included
from termios.h. This error I can not resolve.

Any ideas?

Thanks alot.

-Aaron


Makefile:
...
# X stuff
XPATH = /usr/X11R6
XINCLUDE = ${XPATH}/include
 XLIB = ${XPATH}/lib/
CC = gcc
# All the object files

...

alive: ${RABBIT}
 $(CC) -L${XLIB} -lm -lX11 -o alive ${RABBIT}

serial.o: serial.c serial.h
 $(CC) -c serial.c

xdisplay.o: xdisplay.c ${headers}
 $(CC) -I${XINCLUDE} -c xdisplay.c

>>> Code
xdisplay.c:

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>

...

display = XOpenDisplay(display_name);

>>>serial.c:
#include <fcntl.h>
#include <termios.h>
...
  struct termios ti;
...
  cfmakeraw(&ti);






--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]