Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Message-ID: <3AD7D24F.44F64F82@ece.gatech.edu>
Date: Sat, 14 Apr 2001 00:30:07 -0400
From: "Charles S. Wilson" <cwilson@ece.gatech.edu>
X-Mailer: Mozilla 4.75 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: Felix Natter <fnatter@gmx.net>
CC: cygwin@cygwin.com
Subject: Re: how to compile programs using (n)curses
References: <18571.986757346@www27.gmx.net>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Felix Natter wrote:
> 
> hi,
> 
> when I try to compile a simple (n)curses program using cygwin,
> I get lots of "undefined reference"-messages, one for each ncurses function,
> but with a "impl_" prepended (i.e. impl_waddch).

You probably mean "_imp_" is prepended.  The problem is a mismatch
between your compilation command and your link command.  Apparently, you
did this:

(compile): gcc -c foo.c -o foo.o
and one of the following:
(link   ): gcc -static -o foo.exe foo.o -lncurses
(link   ): gcc -o foo.exe foo.o /usr/lib/libncurses.a

That is, you compiled with the default flags, which set things up for
dll linking, but then explicitly linked to the static library (by
specifying -static, or listing the static lib on the command line
directly).

If you want static linking, then you must compile all your object files
with the -DNCURSES_STATIC flag:
(compile): gcc -DNCURSES_STATIC -c foo.c -o foo.o
then link as above.

If you want dynamic linking, then compile normally (no _STATIC flags)
but link as follows:
(link   ): gcc -o foo.exe foo.o -lncurses (no -static flag, or)
(link   ): gcc -o foo.exe foo.o /usr/lib/libncurses.dll.a

You will probably find /usr/doc/Cygwin/ncurses-5.2.README of interest,
as well as the cygwin-announce messages referenced in that README.

--Chuck

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

