X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 	tests=AWL,BAYES_20,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <49A7FA08.2060603@gmail.com>
Date: Fri, 27 Feb 2009 14:34:48 +0000
From: Dave Korn <dave.korn.cygwin@googlemail.com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: 1.5.25-15: First steps with ncurses programming: can NOT build  Hello_world app
References: <930362.19329.qm@web33204.mail.mud.yahoo.com>
In-Reply-To: <930362.19329.qm@web33204.mail.mud.yahoo.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Alexey Lyubimov wrote:
> Hello, I decided to learn HOWTO write applications with ncurses library,
> but my attempt failed during linking step (seems to me, that for some
> reason ld did not find stdscr).

  Not quite.  It found it, but wasn't prepared for /where/ it found it.

> $ gcc -otnc -g tnc.c -lncurses 
> /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:
> warning: auto-importing has been activated without --enable-auto-import
> specified on the command line. This should work unless it involves constant
> data structures referencing symbols from auto-imported DLLs.Info: resolving
> _stdscr by linking to __imp__stdscr (auto-import)

  On win32, linking against shared libraries (DLLs) doesn't work quite the
same as on Linux platforms, and this is one of the minor cases.  You need to
pass the --enable-auto-import option to the linker, which can be done by
adding "-Wl,--enable-auto-import" to your gcc command line.

  Also, the reason it seems to do nothing is because as soon as it prints
"Hello World", it immediately exits, restoring the original screen contents!
Try adding "getc(stdin)" just after the refresh() call if you want to see the
output!

    cheers,
      DaveK


--
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/

