1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-02-27 Thread Alexey Lyubimov
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).

OS: Win98SE

Source (tnc.c):

#include  /* -lncurses */

int
main(int argc, char** argv)
{
  // Determine the terminal type and initialize curses data structures.
  // The first function called should almost always be initscr().
  initscr();

  printw("Hello World!"); // write to an imaginary window (stdscr buffer)
  refresh(); // dump the buffer contents on the screen
  
  // Clean up after the curses routines. Anytime after the call to
  // initscr(), endwin() should be called before exiting.
  endwin();
}


$ 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)

Notes:
1. Without refresh() call, the program builds and runs Ok (but, of course, 
nothing is shown on the "real" screen).
2. After adding refresh() call, I get the "auto-import" warning shown above, 
and again NOTHING is shown on the real screen during program run :-(

Can anybody explain me, where is my mistake?

--
Thank you.
Alexey Lyubimov


  
Cygwin Configuration Diagnostics
Current System Time: Fri Feb 27 16:30:03 2009

Windows 98 SE Ver 4.10 Build  

Path:   C:\cygwin\usr\sbin
e:\home\ael\bin
C:\cygwin\usr\local\bin
C:\cygwin\bin
C:\cygwin\bin
C:\cygwin\usr\X11R6\bin
e:\HOME\AEL\BIN
e:\SIEMENS\COMMON\BIN
e:\SIEMENS\COMMON\SQLANY
c:\WINDOWS
c:\WINDOWS\COMMAND
e:\USR\BIN
e:\PROGRA~1\BORLAND\CBUILD~1\BIN
e:\PROGRA~1\BORLAND\CBUILD~1\PROJECTS\BPL
c:\PROGRA~1\COMMON~1\AUTODE~1
e:\USR\LOCAL\MATLAB6P5P1\BIN\WIN32
e:\USR\LOCAL\SVN\BIN
e:\PROGRA~1\IMAGEMAGICK-6.4.9-Q16\BIN
e:\PROGRA~1\7-ZIP
e:\PROGRA~1\SDCC\BIN
e:\PROGRA~1\FIREBIRD\FIREBIRD_2_1\BIN

Output from C:\cygwin\bin\id.exe (nontsec)
UID: 910(ael) GID: 544(all)
544(all)

Output from C:\cygwin\bin\id.exe (ntsec)
UID: 910(ael) GID: 544(all)
544(all)

SysDir: C:\WINDOWS\SYSTEM
WinDir: C:\WINDOWS

USER = 'ael'
PWD = '/cygdrive/e/home/ael/work/ncurses'
CYGWIN = 'server'
HOME = '/cygdrive/e/home/ael'
MAKE_MODE = 'unix'

MANPATH = 
'/usr/local/man:/usr/man:/usr/share/man:/usr/autotool/devel/man::/usr/ssl/man'
SQLANY = 'e:\Siemens\Common\sqlany'
HOSTNAME = 'AEL'
TERM = 'cygwin'
CMDLINE = 'bash --login -i'
WINDIR = 'C:\WINDOWS'
CVSROOT = ':local:/cygdrive/c/usr/local/CVS'
OLDPWD = '/cygdrive/e/home/ael/work/gt'
SNDSCAPE = 'C:\WINDOWS'
TEMP = '/cygdrive/c/windows/temp'
TVDUMPFLAGS = '8'
TZ = 'UTC-3MSD'
PS1 = '\[\033]0;\w\007
\033[32m\...@\h \[\033[33m\w\033[0m\]
$ '
!C: = 'C:\cygwin\bin'
WINBOOTDIR = 'C:\WINDOWS'
SHLVL = '1'
FIREBIRD = 'e:\progra~1\firebird\firebird_2_1'
BLASTER = 'A220 I7 D1 T2 '
COMSPEC = 'C:\COMMAND.COM'
PROMPT = '$p$g'
TMP = '/cygdrive/c/windows/temp'
PRINTER = 'PDFCreator'
CVS_RSH = '/bin/ssh'
S7TMP = 'E:\Siemens\Step7\S7tmp'
PGDATA = '/usr/share/postgresql/data'
!E: = 'E:\home\ael\work\ncurses'
INFOPATH = 
'/usr/local/info:/usr/info:/usr/share/info:/usr/autotool/devel/info:/usr/autotool/stable/info:'
_ = '/usr/bin/cygcheck'
SYSTEMROOT = 'C:\WINDOWS'

HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions
HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
  (default) = '/cygdrive'
  cygdrive flags = 0x0022
HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2
  (default) = '/cygdrive'
  cygdrive flags = 0x0022
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = 'C:\cygwin'
  flags = 0x000a
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = 'C:\cygwin/bin'
  flags = 0x000a
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = 'C:\cygwin/lib'
  flags = 0x000a
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\Program Options

a:  fd N/AN/A
c:  hd  FAT32 2935Mb  41% CPUN   DOS_32
d:  hd  FAT 46Mb  55% CPUN   DOS
e:  hd  FAT3212350Mb  92% CPUN   
f:  cd N/AN/A

.  /cygdrive  userbinmode,cygdrive
C:\cygwin  /  system  binmode
C:\cygwin/bin  /usr/bin   system  binmode
C:\cygwin/lib  /usr/lib   system  binmode
.  /cygdrive  system  binmode,cygd

Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-02-27 Thread Dave Korn
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/



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-02-27 Thread Alexey Lyubimov

Thanks a lot, Dave!
Your advices helped!

But, can I ask you two more questions:
1. Why did initscr() and endwin() not require --enable-auto-import option, but 
refresh() does?
2. Can you point me to the right place in the documentation (Cygwins's, gcc's, 
ld's or I don't know whose :)) where auto-import is explained in not very 
complicated manner (with examples of practical usage for Win32)?

--
Thank you,
Alexey


  

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



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-02-27 Thread Greg Chicares
[Reformatted--please see:
  http://www.cygwin.com/acronyms/#PCYMTWLL
Thanks.]

On 2009-02-27 15:10Z, Alexey Lyubimov wrote:
> 
> 2. Can you point me to the right place in the documentation
> (Cygwins's, gcc's, ld's or I don't know whose :)) where
> auto-import is explained in not very complicated manner
> (with examples of practical usage for Win32)?

It's a linker (ld) option, so do this:
  man ld
then type this:
  /auto-import
and hit Enter.

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



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-02-27 Thread Dave Korn
Alexey Lyubimov wrote:

> 1. Why did initscr() and endwin() not require --enable-auto-import option,
> but refresh() does?

  It's because the initscr() and endwin() functions don't refer to the _stdscr
variable internally, so they don't trigger the linker to import anything from
the ncurses DLL; i.e., it's just an incidental detail of the internal
implementation of the code.

  (I'm about to commit a patch upstream that will turn on auto-import by
default on cygwin, so future releases of binutils won't issue this warning any
more.)

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/



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-02-27 Thread Vincent R.
On Fri, 27 Feb 2009 15:59:13 +, Dave Korn
 wrote:
> Alexey Lyubimov wrote:
> 
>> 1. Why did initscr() and endwin() not require --enable-auto-import
>> option,
>> but refresh() does?
> 
>   It's because the initscr() and endwin() functions don't refer to the
>   _stdscr
> variable internally, so they don't trigger the linker to import anything
> from
> the ncurses DLL; i.e., it's just an incidental detail of the internal
> implementation of the code.
> 
>   (I'm about to commit a patch upstream that will turn on auto-import by
> default on cygwin, so future releases of binutils won't issue this
warning
> any
> more.)
> 
> cheers,
>   DaveK
> 
Dave,

how can you answer to so many people on so different topics and on so
different ML.
Are you human ;-) ?




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



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-02-27 Thread Dave Korn
Vincent R. wrote:

> Dave,
> 
> how can you answer to so many people on so different topics and on so
> different ML.
> Are you human ;-) ?

  It's just the spirit of the age ...

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/



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-03-03 Thread Alexey Lyubimov
Unfortunately, things went worse :-(
After I've upgraded to GCC 3.4.4-999 and libncurses9-5.7-2 I get the following 
error instead of a ld's warning (see my first message in this thread for the 
reference):

$ gcc -otnc -g -Wl,--enable-auto-import tnc.c -lncurses
/cygdrive/c/windows/temp/ccUqygVy.o: In function `main':
/cygdrive/e/home/ael/work/ncurses/tnc.c:15: undefined reference to `_stdscr'
collect2: ld returned 1 exit status

"-Wl,--enable-auto-import" works fine with the previous release of GCC v3.4.4-3 
and libncurses8.

What is wrong now?

--
Thank you,
Alexey Lyubimov





  
Cygwin Configuration Diagnostics
Current System Time: Tue Mar 03 14:36:23 2009

Windows 98 SE Ver 4.10 Build  

Path:   C:\cygwin\usr\sbin
e:\home\ael\bin
C:\cygwin\usr\local\bin
C:\cygwin\bin
C:\cygwin\bin
C:\cygwin\usr\X11R6\bin
e:\HOME\AEL\BIN
e:\SIEMENS\COMMON\BIN
e:\SIEMENS\COMMON\SQLANY
c:\WINDOWS
c:\WINDOWS\COMMAND
e:\USR\BIN
e:\PROGRA~1\BORLAND\CBUILD~1\BIN
e:\PROGRA~1\BORLAND\CBUILD~1\PROJECTS\BPL
c:\PROGRA~1\COMMON~1\AUTODE~1
e:\USR\LOCAL\MATLAB6P5P1\BIN\WIN32
e:\USR\LOCAL\SVN\BIN
e:\PROGRA~1\IMAGEMAGICK-6.4.9-Q16\BIN
e:\PROGRA~1\7-ZIP
e:\PROGRA~1\SDCC\BIN
e:\PROGRA~1\FIREBIRD\FIREBIRD_2_1\BIN

Output from C:\cygwin\bin\id.exe (nontsec)
UID: 910(ael) GID: 544(all)
544(all)

Output from C:\cygwin\bin\id.exe (ntsec)
UID: 910(ael) GID: 544(all)
544(all)

SysDir: C:\WINDOWS\SYSTEM
WinDir: C:\WINDOWS

USER = 'ael'
PWD = '/cygdrive/e/home/ael/work/ncurses'
CYGWIN = 'server'
HOME = '/cygdrive/e/home/ael'
MAKE_MODE = 'unix'

MANPATH = 
'/usr/local/man:/usr/man:/usr/share/man:/usr/autotool/devel/man::/usr/ssl/man'
SQLANY = 'e:\Siemens\Common\sqlany'
HOSTNAME = 'AEL'
TERM = 'cygwin'
CMDLINE = 'bash --login -i'
WINDIR = 'C:\WINDOWS'
CVSROOT = ':local:/cygdrive/c/usr/local/CVS'
OLDPWD = '/cygdrive/e/home/ael/work/gt'
SNDSCAPE = 'C:\WINDOWS'
TEMP = '/cygdrive/c/windows/temp'
TVDUMPFLAGS = '8'
TZ = 'UTC-3MSD'
PS1 = '\[\033]0;\w\007
\033[32m\...@\h \[\033[33m\w\033[0m\]
$ '
!C: = 'C:\cygwin\bin'
WINBOOTDIR = 'C:\WINDOWS'
SHLVL = '1'
FIREBIRD = 'e:\progra~1\firebird\firebird_2_1'
BLASTER = 'A220 I7 D1 T2 '
COMSPEC = 'C:\COMMAND.COM'
PROMPT = '$p$g'
TMP = '/cygdrive/c/windows/temp'
PRINTER = 'PDFCreator'
CVS_RSH = '/bin/ssh'
S7TMP = 'E:\Siemens\Step7\S7tmp'
PGDATA = '/usr/share/postgresql/data'
!E: = 'E:\Program Files\Mozilla Firefox 2'
INFOPATH = 
'/usr/local/info:/usr/info:/usr/share/info:/usr/autotool/devel/info:/usr/autotool/stable/info:'
_ = '/usr/bin/cygcheck'
SYSTEMROOT = 'C:\WINDOWS'

HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions
HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
  (default) = '/cygdrive'
  cygdrive flags = 0x0022
HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2
  (default) = '/cygdrive'
  cygdrive flags = 0x0022
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = 'C:\cygwin'
  flags = 0x000a
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = 'C:\cygwin/bin'
  flags = 0x000a
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = 'C:\cygwin/lib'
  flags = 0x000a
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\Program Options

a:  fd N/AN/A
c:  hd  FAT32 2935Mb  98% CPUN   DOS_32
d:  hd  FAT 46Mb  55% CPUN   DOS
e:  hd  FAT3212350Mb  87% CPUN   
f:  cd N/AN/A

.  /cygdrive  userbinmode,cygdrive
C:\cygwin  /  system  binmode
C:\cygwin/bin  /usr/bin   system  binmode
C:\cygwin/lib  /usr/lib   system  binmode
.  /cygdrive  system  binmode,cygdrive

Found: C:\cygwin\bin\awk.exe
Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: C:\cygwin\bin\cp.exe
Not Found: cpp (good!)
Not Found: crontab
Found: C:\cygwin\bin\find.exe
Found: c:\WINDOWS\COMMAND\find.exe
Warning: C:\cygwin\bin\find.exe hides c:\WINDOWS\COMMAND\find.exe
Not Found: gcc
Found: C:\cygwin\bin\gdb.exe
Found: C:\cygwin\bin\grep.exe
Found: e:\PROGRA~1\BORLAND\CBUILD~1\BIN\grep.exe
Warning: C:\cygwin\bin\grep.exe hides e:\PROGRA~1\BORLAND\CBUILD~1\BIN\grep.exe
Found: C:\cygwin\bin\kill.exe
Found: C:\cygwin\bin\ld.exe
Found: C:\cygwin\bin\ls.exe
Found: C:\cygwin\bin\make.exe
Found: e:\USR\BIN\make.exe
Warning: C:\cygwin\bin\make.exe hides e:\USR\BIN\make.exe
Found: e:\PROGRA~1\BORLAND\CBUILD~1\BIN\make.exe
Warning: C:\cygwin\bin\make.exe hides e:\PROGRA~1\BORLAND\CBUILD~1\BIN\make.exe
Found: C:\cygwin\bin\mv.exe
Found: C:\cygwin\bin\patch.exe
Found: C:\cygwin\bin\perl.exe
Fo

Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-03-03 Thread Dave Korn
Alexey Lyubimov wrote:
> Unfortunately, things went worse :-( After I've upgraded to GCC 3.4.4-999
> and libncurses9-5.7-2 I get the following error instead of a ld's warning
> (see my first message in this thread for the reference):
> 
> $ gcc -otnc -g -Wl,--enable-auto-import tnc.c -lncurses 
> /cygdrive/c/windows/temp/ccUqygVy.o: In function `main': 
> /cygdrive/e/home/ael/work/ncurses/tnc.c:15: undefined reference to
> `_stdscr' collect2: ld returned 1 exit status
> 
> "-Wl,--enable-auto-import" works fine with the previous release of GCC
> v3.4.4-3 and libncurses8.
> 
> What is wrong now?

  Dunno yet, but I'll see if I can reproduce.  There have been updates to
ncurses as well as gcc.  I've still got an old ncurses and new gcc:

/tmp/hash $ cygcheck -c libncurses-devel gcc-core
Cygwin Package Information
Package  VersionStatus
gcc-core 3.4.4-999  OK
libncurses-devel 5.5-3  OK

.. so I'll see if I can reproduce it, then upgrade my ncurses and try again.

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/



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-03-03 Thread Dave Korn
Alexey Lyubimov wrote:

> $ gcc -otnc -g -Wl,--enable-auto-import tnc.c -lncurses 
> /cygdrive/c/windows/temp/ccUqygVy.o: In function `main': 
> /cygdrive/e/home/ael/work/ncurses/tnc.c:15: undefined reference to
> `_stdscr' collect2: ld returned 1 exit status
> 
> "-Wl,--enable-auto-import" works fine with the previous release of GCC
> v3.4.4-3 and libncurses8.
> 
> What is wrong now?

  Dunno, since I can't reproduce it.  But there's been a couple of reissues of
ncurses updates recently owing to bugs connected to the exported apis, and
while you've got libncurses-5.7-2, I just did an update and got 5.7-3, so I
think there's maybe a bugfix version in the process of propagating to the
mirrors and not yet announced.  Try upgrading again!

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/



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-03-03 Thread Alexey Lyubimov

Thanks again, Dave!
I've updated again too, and now ncurses 5.7-3 works for me also! :-)



  

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



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-03-03 Thread Charles Wilson
Alexey Lyubimov wrote:
> Unfortunately, things went worse :-(
> After I've upgraded to GCC 3.4.4-999 and libncurses9-5.7-2 I get the 
> following error instead of a ld's warning (see my first message in this 
> thread for the reference):
> 
> $ gcc -otnc -g -Wl,--enable-auto-import tnc.c -lncurses
> /cygdrive/c/windows/temp/ccUqygVy.o: In function `main':
> /cygdrive/e/home/ael/work/ncurses/tnc.c:15: undefined reference to `_stdscr'
> collect2: ld returned 1 exit status

The only way this could've happened is if you compiled tnc.c with the
5.5-3 headers (that is, the ones matching libncurses8) but tried to link
against libncurses9 (e.g. 5.7-1, 5.7-2, or 5.7-3).  However, because the
link libraries and header files are all distributed together in one
package (libncurses-devel), AND because you compiled and linked all at
once in the same command, I'm at a loss to explain what happened.

FYI, for ease of diagnosing build failures like this, I usually -- even
when an app consists of only a single source file -- compile and link in
separate steps:

$ gcc -g -o tnc.o -c tnc.c
$ gcc -Wl,--enable-auto-import -o tnc tnc.o -lncurses

My first guess, with 5.7-1 and 5.7-2, but not 5.7-3, would be that the
stdscr symbol has moved from the ncurses library to the tinfo library,
so you needed to link using '-lncurses -ltinfo'.  BUT, in the 5.7
versions of ncurses, that symbol is no longer named _stdscr (you use
stdscr in YOUR code, but the ncurses.h header magic turns it into
ncwrap_stdscr() behind your back).  So, if THAT were the problem, you'd
have seen "...tnc.c:15: undefined reference to `_ncwrap_scdstr'" once
you got to the linker stage.

In any case, the tinfo library has been re-merged back into the main
ncurses library with the release of 5.7-3/5.7-12.

So, my recommendation in any case would have been to upgrade to
ncurses-5.7-3 once it propagated to the mirrors. So, I'm glad that fixed
the problem for you.

Sorry for the trouble.

--
Chuck

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



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-03-03 Thread Dave Korn
Charles Wilson wrote:
> Alexey Lyubimov wrote:
>> Unfortunately, things went worse :-(
>> After I've upgraded to GCC 3.4.4-999 and libncurses9-5.7-2 I get the 
>> following error instead of a ld's warning (see my first message in this 
>> thread for the reference):
>>
>> $ gcc -otnc -g -Wl,--enable-auto-import tnc.c -lncurses
>> /cygdrive/c/windows/temp/ccUqygVy.o: In function `main':
>> /cygdrive/e/home/ael/work/ncurses/tnc.c:15: undefined reference to `_stdscr'
>> collect2: ld returned 1 exit status
> 
> The only way this could've happened is if you compiled tnc.c with the
> 5.5-3 headers (that is, the ones matching libncurses8) but tried to link
> against libncurses9 (e.g. 5.7-1, 5.7-2, or 5.7-3).  However, because the
> link libraries and header files are all distributed together in one
> package (libncurses-devel), AND because you compiled and linked all at
> once in the same command, I'm at a loss to explain what happened.

  My guess is that Alexey didn't notice a dll-in-use-must-reboot warning on
cygncurses-8.dll when running setup.exe, and a reboot might have fixed it.

  Erk.  I wonder what happens if you update, it adds a file to the
rename-on-reboot list, then update again - this time without a shell (or
whatever) running so that it goes ahead and installs the even-newer version
successfully.  I suspect a reboot might bring auto-downgrade in its wake :-(
not good.

  Alexey, if this happens, you might need to reinstall libncurses.  If you
haven't rebooted yet, is there a file called "wininit.ini" in your \WINDOWS
folder?  Or any file matching "*.dll.new" in /bin?

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/



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-03-03 Thread Charles Wilson
Dave Korn wrote:
> Charles Wilson wrote:
>> Alexey Lyubimov wrote:

>>> $ gcc -otnc -g -Wl,--enable-auto-import tnc.c -lncurses
>>> /cygdrive/c/windows/temp/ccUqygVy.o: In function `main':
>>> /cygdrive/e/home/ael/work/ncurses/tnc.c:15: undefined reference to `_stdscr'
>>> collect2: ld returned 1 exit status

>   My guess is that Alexey didn't notice a dll-in-use-must-reboot warning on
> cygncurses-8.dll when running setup.exe, and a reboot might have fixed it.

Nah.  That scenario might cause a run-time failure, but not a link-time
failure like the one Alexey described.

--
Chuck


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



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-03-03 Thread Dave Korn
Charles Wilson wrote:
> Dave Korn wrote:
>> Charles Wilson wrote:
>>> Alexey Lyubimov wrote:
> 
 $ gcc -otnc -g -Wl,--enable-auto-import tnc.c -lncurses
 /cygdrive/c/windows/temp/ccUqygVy.o: In function `main':
 /cygdrive/e/home/ael/work/ncurses/tnc.c:15: undefined reference to 
 `_stdscr'
 collect2: ld returned 1 exit status
> 
>>   My guess is that Alexey didn't notice a dll-in-use-must-reboot warning on
>> cygncurses-8.dll when running setup.exe, and a reboot might have fixed it.
> 
> Nah.  That scenario might cause a run-time failure, but not a link-time
> failure like the one Alexey described.

  He'd end up with the old DLL but the /new/ import library, wouldn't he?  So
adding -ltinfo might fix the link, but then it would fail to find the right
imports if he had tried running it?

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/



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-03-03 Thread Charles Wilson
Dave Korn wrote:
> Charles Wilson wrote:
>> Nah.  That scenario might cause a run-time failure, but not a link-time
>> failure like the one Alexey described.
> 
>   He'd end up with the old DLL but the /new/ import library, wouldn't he?  So
> adding -ltinfo might fix the link, but then it would fail to find the right
> imports if he had tried running it?
> 

Exactly.

--
Chuck

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



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-03-03 Thread Dave Korn
Charles Wilson wrote:
> Dave Korn wrote:
>> Charles Wilson wrote:
>>> Nah.  That scenario might cause a run-time failure, but not a link-time
>>> failure like the one Alexey described.
>>   He'd end up with the old DLL but the /new/ import library, wouldn't he?  So
>> adding -ltinfo might fix the link, but then it would fail to find the right
>> imports if he had tried running it?
>>
> 
> Exactly.

  Right; but seeing as he /didn't/ add -ltinfo, he would have ended up with
exactly the error we saw, wouldn't he?

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/



Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app

2009-03-03 Thread Charles Wilson
Dave Korn wrote:

>   Right; but seeing as he /didn't/ add -ltinfo, he would have ended up with
> exactly the error we saw, wouldn't he?

No, because the headers that came with 5.7-2 had macros that turned his
code 'curscr' into 'ncwrap_curscr()'.  In the briefly released 5.7-1 the
macros turned 'curscr' into '_nc_curscr()'.  So, the only way his object
code would be "looking" for the symbol "_curscr" would be if he was
using the headers from ncurses-5.5-3 or older.  But the headers and
import libraries are distributed in the same package; it's not possible
to have the headers from one release and the import libraries from a
different one.

Unless you do
$ gcc -o foo.o -c foo.c

and then upgrade ncurses-devel, before doing
$ gcc -o foo.exe foo.o -lncurses

But Alexey did the compile and link all in one command.  That's a REALLY
fast setup.exe...

That's why I was confused.  But, 'tis working now, with 5.7-3. So...

--
Chuck


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