delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/11/26/12:53:06

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
X-Injected-Via-Gmane: http://gmane.org/
Path: not-for-mail
From: "Aaron Edsinger" <edsinger AT ai DOT mit DOT edu>
Subject: newbie linking problems
Date: Tue, 26 Nov 2002 12:36:15 -0500
Lines: 59
Message-ID: <as0bg2$7e8$1@main.gmane.org>
NNTP-Posting-Host: cholo.ai.mit.edu
X-Trace: main.gmane.org 1038332226 7624 128.52.220.17 (26 Nov 2002 17:37:06 GMT)
X-Complaints-To: usenet AT main DOT gmane DOT org
NNTP-Posting-Date: Tue, 26 Nov 2002 17:37:06 +0000 (UTC)
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019