delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/02/27/09:25:54

X-Recipient: archive-cygwin AT delorie DOT 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 DOT korn DOT cygwin AT googlemail DOT com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app
References: <930362 DOT 19329 DOT qm AT web33204 DOT mail DOT mud DOT yahoo DOT com>
In-Reply-To: <930362.19329.qm@web33204.mail.mud.yahoo.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

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/

- Raw text -


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