This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 27 Feb 2009 14:34:48 +0000
- 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>
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/