Mail Archives: cygwin/2009/03/03/11:28:17
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/
- Raw text -